Only test for typedefinitions in current module
This commit is contained in:
		
							parent
							
								
									b723ff2d06
								
							
						
					
					
						commit
						82758ae333
					
				| @ -32,7 +32,7 @@ impl Display for Context { | ||||
| 
 | ||||
| impl Display for Module { | ||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||
|         writeln!(f, "Module({}) {{", self.name)?; | ||||
|         writeln!(f, "Module({}) ({}) {{", self.name, self.module_id)?; | ||||
| 
 | ||||
|         let mut state = Default::default(); | ||||
|         let mut inner_f = PadAdapter::wrap(f, &mut state); | ||||
|  | ||||
| @ -774,15 +774,21 @@ impl TypeKind { | ||||
|     fn is_known(&self, refs: &TypeRefs, state: &TypecheckPassState) -> Result<(), ErrorKind> { | ||||
|         match &self { | ||||
|             TypeKind::Array(type_kind, _) => type_kind.as_ref().is_known(refs, state), | ||||
|             TypeKind::CustomType(custom_type_key) => state | ||||
|                 .scope | ||||
|                 .types | ||||
|                 .get(custom_type_key) | ||||
|                 .map(|_| ()) | ||||
|                 .ok_or(ErrorKind::NoSuchType( | ||||
|                     custom_type_key.0.clone(), | ||||
|                     state.module_id.unwrap(), | ||||
|                 )), | ||||
|             TypeKind::CustomType(custom_type_key) => { | ||||
|                 if custom_type_key.1 == state.module_id.unwrap() { | ||||
|                     state | ||||
|                         .scope | ||||
|                         .types | ||||
|                         .get(custom_type_key) | ||||
|                         .map(|_| ()) | ||||
|                         .ok_or(ErrorKind::NoSuchType( | ||||
|                             custom_type_key.0.clone(), | ||||
|                             state.module_id.unwrap(), | ||||
|                         )) | ||||
|                 } else { | ||||
|                     Ok(()) | ||||
|                 } | ||||
|             } | ||||
|             TypeKind::Borrow(type_kind, _) => type_kind.is_known(refs, state), | ||||
|             TypeKind::UserPtr(type_kind) => type_kind.is_known(refs, state), | ||||
|             TypeKind::CodegenPtr(type_kind) => type_kind.is_known(refs, state), | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user