aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lower.rs
diff options
context:
space:
mode:
authorLaurenČ›iu Nicola <[email protected]>2021-04-05 13:37:11 +0100
committerLaurenČ›iu Nicola <[email protected]>2021-04-05 13:39:06 +0100
commit65c2e5194034e4f6f556b96e71ce62bc2a465a35 (patch)
tree6ff56eca6210f2a87ca9caa8a7485c9ff567dc5e /crates/hir_ty/src/lower.rs
parentd8ee25bb976f50c0c0c8c247ca8bb030d9167bdb (diff)
Rename TyKind::Unknown to Error
Diffstat (limited to 'crates/hir_ty/src/lower.rs')
-rw-r--r--crates/hir_ty/src/lower.rs38
1 files changed, 19 insertions, 19 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index 214655807..dd40eb5c3 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -176,7 +176,7 @@ impl<'a> TyLoweringContext<'a> {
176 let inner_ty = self.lower_ty(inner); 176 let inner_ty = self.lower_ty(inner);
177 TyKind::Ref(lower_to_chalk_mutability(*mutability), inner_ty).intern(&Interner) 177 TyKind::Ref(lower_to_chalk_mutability(*mutability), inner_ty).intern(&Interner)
178 } 178 }
179 TypeRef::Placeholder => TyKind::Unknown.intern(&Interner), 179 TypeRef::Placeholder => TyKind::Error.intern(&Interner),
180 TypeRef::Fn(params, is_varargs) => { 180 TypeRef::Fn(params, is_varargs) => {
181 let substs = 181 let substs =
182 Substitution::from_iter(&Interner, params.iter().map(|tr| self.lower_ty(tr))); 182 Substitution::from_iter(&Interner, params.iter().map(|tr| self.lower_ty(tr)));
@@ -253,12 +253,12 @@ impl<'a> TyLoweringContext<'a> {
253 data.provenance == TypeParamProvenance::ArgumentImplTrait 253 data.provenance == TypeParamProvenance::ArgumentImplTrait
254 }) 254 })
255 .nth(idx as usize) 255 .nth(idx as usize)
256 .map_or(TyKind::Unknown, |(id, _)| { 256 .map_or(TyKind::Error, |(id, _)| {
257 TyKind::Placeholder(to_placeholder_idx(self.db, id)) 257 TyKind::Placeholder(to_placeholder_idx(self.db, id))
258 }); 258 });
259 param.intern(&Interner) 259 param.intern(&Interner)
260 } else { 260 } else {
261 TyKind::Unknown.intern(&Interner) 261 TyKind::Error.intern(&Interner)
262 } 262 }
263 } 263 }
264 ImplTraitLoweringMode::Variable => { 264 ImplTraitLoweringMode::Variable => {
@@ -280,11 +280,11 @@ impl<'a> TyLoweringContext<'a> {
280 } 280 }
281 ImplTraitLoweringMode::Disallowed => { 281 ImplTraitLoweringMode::Disallowed => {
282 // FIXME: report error 282 // FIXME: report error
283 TyKind::Unknown.intern(&Interner) 283 TyKind::Error.intern(&Interner)
284 } 284 }
285 } 285 }
286 } 286 }
287 TypeRef::Error => TyKind::Unknown.intern(&Interner), 287 TypeRef::Error => TyKind::Error.intern(&Interner),
288 }; 288 };
289 (ty, res) 289 (ty, res)
290 } 290 }
@@ -328,7 +328,7 @@ impl<'a> TyLoweringContext<'a> {
328 (self.select_associated_type(res, segment), None) 328 (self.select_associated_type(res, segment), None)
329 } else if remaining_segments.len() > 1 { 329 } else if remaining_segments.len() > 1 {
330 // FIXME report error (ambiguous associated type) 330 // FIXME report error (ambiguous associated type)
331 (TyKind::Unknown.intern(&Interner), None) 331 (TyKind::Error.intern(&Interner), None)
332 } else { 332 } else {
333 (ty, res) 333 (ty, res)
334 } 334 }
@@ -372,12 +372,12 @@ impl<'a> TyLoweringContext<'a> {
372 } 372 }
373 None => { 373 None => {
374 // FIXME: report error (associated type not found) 374 // FIXME: report error (associated type not found)
375 TyKind::Unknown.intern(&Interner) 375 TyKind::Error.intern(&Interner)
376 } 376 }
377 } 377 }
378 } else if remaining_segments.len() > 1 { 378 } else if remaining_segments.len() > 1 {
379 // FIXME report error (ambiguous associated type) 379 // FIXME report error (ambiguous associated type)
380 TyKind::Unknown.intern(&Interner) 380 TyKind::Error.intern(&Interner)
381 } else { 381 } else {
382 let dyn_ty = DynTy { 382 let dyn_ty = DynTy {
383 bounds: Binders::new( 383 bounds: Binders::new(
@@ -433,7 +433,7 @@ impl<'a> TyLoweringContext<'a> {
433 self.lower_path_inner(resolved_segment, it.into(), infer_args) 433 self.lower_path_inner(resolved_segment, it.into(), infer_args)
434 } 434 }
435 // FIXME: report error 435 // FIXME: report error
436 TypeNs::EnumVariantId(_) => return (TyKind::Unknown.intern(&Interner), None), 436 TypeNs::EnumVariantId(_) => return (TyKind::Error.intern(&Interner), None),
437 }; 437 };
438 self.lower_ty_relative_path(ty, Some(resolution), remaining_segments) 438 self.lower_ty_relative_path(ty, Some(resolution), remaining_segments)
439 } 439 }
@@ -447,7 +447,7 @@ impl<'a> TyLoweringContext<'a> {
447 let (resolution, remaining_index) = 447 let (resolution, remaining_index) =
448 match self.resolver.resolve_path_in_type_ns(self.db.upcast(), path.mod_path()) { 448 match self.resolver.resolve_path_in_type_ns(self.db.upcast(), path.mod_path()) {
449 Some(it) => it, 449 Some(it) => it,
450 None => return (TyKind::Unknown.intern(&Interner), None), 450 None => return (TyKind::Error.intern(&Interner), None),
451 }; 451 };
452 let (resolved_segment, remaining_segments) = match remaining_index { 452 let (resolved_segment, remaining_segments) = match remaining_index {
453 None => ( 453 None => (
@@ -498,9 +498,9 @@ impl<'a> TyLoweringContext<'a> {
498 }, 498 },
499 ); 499 );
500 500
501 ty.unwrap_or(TyKind::Unknown.intern(&Interner)) 501 ty.unwrap_or(TyKind::Error.intern(&Interner))
502 } else { 502 } else {
503 TyKind::Unknown.intern(&Interner) 503 TyKind::Error.intern(&Interner)
504 } 504 }
505 } 505 }
506 506
@@ -569,13 +569,13 @@ impl<'a> TyLoweringContext<'a> {
569 def_generics.map_or((0, 0, 0, 0), |g| g.provenance_split()); 569 def_generics.map_or((0, 0, 0, 0), |g| g.provenance_split());
570 let total_len = parent_params + self_params + type_params + impl_trait_params; 570 let total_len = parent_params + self_params + type_params + impl_trait_params;
571 571
572 substs.extend(iter::repeat(TyKind::Unknown.intern(&Interner)).take(parent_params)); 572 substs.extend(iter::repeat(TyKind::Error.intern(&Interner)).take(parent_params));
573 573
574 let fill_self_params = || { 574 let fill_self_params = || {
575 substs.extend( 575 substs.extend(
576 explicit_self_ty 576 explicit_self_ty
577 .into_iter() 577 .into_iter()
578 .chain(iter::repeat(TyKind::Unknown.intern(&Interner))) 578 .chain(iter::repeat(TyKind::Error.intern(&Interner)))
579 .take(self_params), 579 .take(self_params),
580 ) 580 )
581 }; 581 };
@@ -628,7 +628,7 @@ impl<'a> TyLoweringContext<'a> {
628 // add placeholders for args that were not provided 628 // add placeholders for args that were not provided
629 // FIXME: emit diagnostics in contexts where this is not allowed 629 // FIXME: emit diagnostics in contexts where this is not allowed
630 for _ in substs.len()..total_len { 630 for _ in substs.len()..total_len {
631 substs.push(TyKind::Unknown.intern(&Interner)); 631 substs.push(TyKind::Error.intern(&Interner));
632 } 632 }
633 assert_eq!(substs.len(), total_len); 633 assert_eq!(substs.len(), total_len);
634 634
@@ -1008,7 +1008,7 @@ pub(crate) fn generic_defaults_query(
1008 .enumerate() 1008 .enumerate()
1009 .map(|(idx, (_, p))| { 1009 .map(|(idx, (_, p))| {
1010 let mut ty = 1010 let mut ty =
1011 p.default.as_ref().map_or(TyKind::Unknown.intern(&Interner), |t| ctx.lower_ty(t)); 1011 p.default.as_ref().map_or(TyKind::Error.intern(&Interner), |t| ctx.lower_ty(t));
1012 1012
1013 // Each default can only refer to previous parameters. 1013 // Each default can only refer to previous parameters.
1014 ty.walk_mut_binders( 1014 ty.walk_mut_binders(
@@ -1018,7 +1018,7 @@ pub(crate) fn generic_defaults_query(
1018 // type variable default referring to parameter coming 1018 // type variable default referring to parameter coming
1019 // after it. This is forbidden (FIXME: report 1019 // after it. This is forbidden (FIXME: report
1020 // diagnostic) 1020 // diagnostic)
1021 *ty = TyKind::Unknown.intern(&Interner); 1021 *ty = TyKind::Error.intern(&Interner);
1022 } 1022 }
1023 } 1023 }
1024 _ => {} 1024 _ => {}
@@ -1220,7 +1220,7 @@ pub(crate) fn ty_recover(db: &dyn HirDatabase, _cycle: &[String], def: &TyDefId)
1220 TyDefId::AdtId(it) => generics(db.upcast(), it.into()).len(), 1220 TyDefId::AdtId(it) => generics(db.upcast(), it.into()).len(),
1221 TyDefId::TypeAliasId(it) => generics(db.upcast(), it.into()).len(), 1221 TyDefId::TypeAliasId(it) => generics(db.upcast(), it.into()).len(),
1222 }; 1222 };
1223 Binders::new(num_binders, TyKind::Unknown.intern(&Interner)) 1223 Binders::new(num_binders, TyKind::Error.intern(&Interner))
1224} 1224}
1225 1225
1226pub(crate) fn value_ty_query(db: &dyn HirDatabase, def: ValueTyDefId) -> Binders<Ty> { 1226pub(crate) fn value_ty_query(db: &dyn HirDatabase, def: ValueTyDefId) -> Binders<Ty> {
@@ -1258,7 +1258,7 @@ pub(crate) fn impl_self_ty_recover(
1258 impl_id: &ImplId, 1258 impl_id: &ImplId,
1259) -> Binders<Ty> { 1259) -> Binders<Ty> {
1260 let generics = generics(db.upcast(), (*impl_id).into()); 1260 let generics = generics(db.upcast(), (*impl_id).into());
1261 Binders::new(generics.len(), TyKind::Unknown.intern(&Interner)) 1261 Binders::new(generics.len(), TyKind::Error.intern(&Interner))
1262} 1262}
1263 1263
1264pub(crate) fn impl_trait_query(db: &dyn HirDatabase, impl_id: ImplId) -> Option<Binders<TraitRef>> { 1264pub(crate) fn impl_trait_query(db: &dyn HirDatabase, impl_id: ImplId) -> Option<Binders<TraitRef>> {