Fix bug in generic function name replacement
This commit is contained in:
		
							parent
							
								
									107303aa98
								
							
						
					
					
						commit
						384703fbd2
					
				| @ -216,7 +216,6 @@ impl mir::Module { | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 TypeDefinitionKind::Generic => panic!("Tried compiling a generic!"), | ||||
|             }; | ||||
| 
 | ||||
|             if is_ok { | ||||
| @ -241,7 +240,6 @@ impl mir::Module { | ||||
|                             .collect(), | ||||
|                     ))) | ||||
|                 } | ||||
|                 TypeDefinitionKind::Generic => panic!("Tried compiling a generic!"), | ||||
|             }; | ||||
|             types.insert(type_value, typedef.clone()); | ||||
|             type_values.insert(type_key.clone(), type_value); | ||||
|  | ||||
| @ -96,7 +96,6 @@ impl TypeKind { | ||||
|             TypeKind::UserPtr(type_kind) => Type::Ptr(Box::new(type_kind.get_type(type_vals))), | ||||
|             TypeKind::CodegenPtr(type_kind) => Type::Ptr(Box::new(type_kind.get_type(type_vals))), | ||||
|             TypeKind::Borrow(type_kind, _) => Type::Ptr(Box::new(type_kind.get_type(type_vals))), | ||||
|             TypeKind::Generic(_) => panic!("Tried to compile a generic type!"), | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -211,7 +210,6 @@ impl TypeKind { | ||||
|                             }) | ||||
|                         } | ||||
|                     } | ||||
|                     TypeDefinitionKind::Generic => panic!("Tried to generate debug-info for a generic!"), | ||||
|                 } | ||||
|             } | ||||
|             _ => DebugTypeData::Basic(DebugBasicType { | ||||
|  | ||||
| @ -140,7 +140,6 @@ impl Display for TypeDefinitionKind { | ||||
|                 } | ||||
|                 f.write_char('}') | ||||
|             } | ||||
|             TypeDefinitionKind::Generic => write!(f, "generic"), | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -483,7 +482,6 @@ impl Display for TypeKind { | ||||
|             TypeKind::F128 => write!(f, "f128"), | ||||
|             TypeKind::F80 => write!(f, "f80"), | ||||
|             TypeKind::F128PPC => write!(f, "f128ppc"), | ||||
|             TypeKind::Generic(name) => write!(f, "Generic<{}>", name), | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -239,7 +239,9 @@ impl mir::Expression { | ||||
|                         vec![(function_call.generics.clone(), self.1)], | ||||
|                     ); | ||||
|                 } | ||||
|                 function_call.name = name_fmt(function_call.name.clone(), function_call.generics.clone()) | ||||
|                 if function_call.generics.len() > 0 { | ||||
|                     function_call.name = name_fmt(function_call.name.clone(), function_call.generics.clone()) | ||||
|                 } | ||||
|             } | ||||
|             mir::ExprKind::AssociatedFunctionCall(ty, function_call) => { | ||||
|                 if let Some(calls) = assoc_calls.get_mut(&(ty.clone(), function_call.name.clone())) { | ||||
| @ -250,7 +252,9 @@ impl mir::Expression { | ||||
|                         vec![(function_call.generics.clone(), self.1)], | ||||
|                     ); | ||||
|                 } | ||||
|                 function_call.name = name_fmt(function_call.name.clone(), function_call.generics.clone()) | ||||
|                 if function_call.generics.len() > 0 { | ||||
|                     function_call.name = name_fmt(function_call.name.clone(), function_call.generics.clone()) | ||||
|                 } | ||||
|             } | ||||
|             mir::ExprKind::If(IfExpression(cond, then_e, else_e)) => { | ||||
|                 cond.find_calls(calls, assoc_calls); | ||||
|  | ||||
| @ -54,7 +54,6 @@ impl TypeKind { | ||||
|             TypeKind::F128 => true, | ||||
|             TypeKind::F80 => true, | ||||
|             TypeKind::F128PPC => true, | ||||
|             TypeKind::Generic(_) => false, | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| @ -83,7 +82,6 @@ impl TypeKind { | ||||
|                         } | ||||
|                         size | ||||
|                     } | ||||
|                     TypeDefinitionKind::Generic => 404, | ||||
|                 }, | ||||
|                 // Easy to recognize default number. Used e.g. when sorting
 | ||||
|                 // types by size
 | ||||
| @ -100,7 +98,6 @@ impl TypeKind { | ||||
|             TypeKind::F128 => 128, | ||||
|             TypeKind::F80 => 80, | ||||
|             TypeKind::F128PPC => 128, | ||||
|             TypeKind::Generic(_) => 0, | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| @ -132,7 +129,6 @@ impl TypeKind { | ||||
|             TypeKind::F128 => 128, | ||||
|             TypeKind::F80 => 80, | ||||
|             TypeKind::F128PPC => 128, | ||||
|             TypeKind::Generic(_) => 0, | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| @ -177,7 +173,6 @@ impl TypeKind { | ||||
|                 VagueType::TypeRef(_) => TypeCategory::TypeRef, | ||||
|                 VagueType::Named(_) => TypeCategory::Other, | ||||
|             }, | ||||
|             TypeKind::Generic(_) => TypeCategory::Other, | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -542,7 +542,6 @@ impl<'map> Pass for LinkerPass<'map> { | ||||
|                             field.1 = field.1.update_imported(foreign_types); | ||||
|                         } | ||||
|                     } | ||||
|                     TypeDefinitionKind::Generic => {} | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| @ -703,7 +702,6 @@ fn resolve_types_recursively( | ||||
|                         types.extend(resolve_types_recursively(&field.1, modules, seen.clone())?); | ||||
|                     } | ||||
|                 } | ||||
|                 TypeDefinitionKind::Generic => {} | ||||
|             } | ||||
|         } | ||||
|         TypeKind::Array(type_kind, _) => types.extend(resolve_types_recursively(&type_kind, modules, seen.clone())?), | ||||
|  | ||||
| @ -133,7 +133,6 @@ pub enum TypeKind { | ||||
|     Borrow(Box<TypeKind>, bool), | ||||
|     UserPtr(Box<TypeKind>), | ||||
|     CodegenPtr(Box<TypeKind>), | ||||
|     Generic(String), | ||||
|     Vague(VagueType), | ||||
| } | ||||
| 
 | ||||
| @ -457,7 +456,6 @@ pub struct TypeDefinition { | ||||
| #[derive(Debug, Clone)] | ||||
| pub enum TypeDefinitionKind { | ||||
|     Struct(StructType), | ||||
|     Generic, | ||||
| } | ||||
| 
 | ||||
| #[derive(Debug)] | ||||
|  | ||||
| @ -150,7 +150,6 @@ impl<Data: Clone + Default> Scope<Data> { | ||||
|         let ty = self.types.get(&key)?; | ||||
|         match &ty.kind { | ||||
|             TypeDefinitionKind::Struct(struct_ty) => Some(struct_ty), | ||||
|             TypeDefinitionKind::Generic => None, | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -48,7 +48,6 @@ impl<'t> Pass for TypeCheck<'t> { | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 TypeDefinitionKind::Generic => todo!(), | ||||
|             } | ||||
| 
 | ||||
|             if typedef.source_module == module.module_id || typedef.importer == Some(module.module_id) { | ||||
| @ -107,7 +106,6 @@ fn check_typedefs_for_recursion<'a, 'b>( | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         TypeDefinitionKind::Generic => {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user