@@ -901,11 +901,7 @@ fn serializeModuleEnv(
901901/// For builtin_compiler, types are always in all_statements (not builtin_statements)
902902/// because we're compiling Builtin.roc itself, not importing from it.
903903fn findTypeDeclaration (env : * const ModuleEnv , type_name : []const u8 ) ! CIR.Statement.Idx {
904- // Construct the qualified name (e.g., "Builtin.Bool")
905- // Types in nested declarations are stored with their full qualified names
906- var qualified_name_buf : [256 ]u8 = undefined ;
907- const qualified_name = try std .fmt .bufPrint (& qualified_name_buf , "{s}.{s}" , .{ env .module_name , type_name });
908-
904+ // Type headers now store the unqualified name (e.g., "Bool" not "Builtin.Bool")
909905 // Search in all_statements (where Builtin.roc's own types are stored)
910906 const all_stmts = env .store .sliceStatements (env .all_statements );
911907 for (all_stmts ) | stmt_idx | {
@@ -915,7 +911,7 @@ fn findTypeDeclaration(env: *const ModuleEnv, type_name: []const u8) !CIR.Statem
915911 const header = env .store .getTypeHeader (decl .header );
916912 const ident_idx = header .name ;
917913 const ident_text = env .getIdentText (ident_idx );
918- if (std .mem .eql (u8 , ident_text , qualified_name )) {
914+ if (std .mem .eql (u8 , ident_text , type_name )) {
919915 return stmt_idx ;
920916 }
921917 },
@@ -927,13 +923,13 @@ fn findTypeDeclaration(env: *const ModuleEnv, type_name: []const u8) !CIR.Statem
927923}
928924
929925/// Find a nested type declaration by parent and type name in a compiled module
930- /// For example, findNestedTypeDeclaration(env, "Num", "U8") finds "Builtin.Num.U8"
926+ /// For example, findNestedTypeDeclaration(env, "Num", "U8") finds type with header.name = "U8"
927+ /// The parent_name parameter is ignored since type headers store the unqualified name
931928/// Returns the statement index of the type declaration
932929fn findNestedTypeDeclaration (env : * const ModuleEnv , parent_name : []const u8 , type_name : []const u8 ) ! CIR.Statement.Idx {
933- // Construct the qualified name (e.g., "Builtin.Num.U8")
934- var qualified_name_buf : [256 ]u8 = undefined ;
935- const qualified_name = try std .fmt .bufPrint (& qualified_name_buf , "{s}.{s}.{s}" , .{ env .module_name , parent_name , type_name });
930+ _ = parent_name ; // Type headers store unqualified names
936931
932+ // Type headers now store the unqualified name (e.g., "U8" not "Builtin.Num.U8")
937933 // Search in all_statements (where Builtin.roc's own types are stored)
938934 const all_stmts = env .store .sliceStatements (env .all_statements );
939935 for (all_stmts ) | stmt_idx | {
@@ -943,7 +939,7 @@ fn findNestedTypeDeclaration(env: *const ModuleEnv, parent_name: []const u8, typ
943939 const header = env .store .getTypeHeader (decl .header );
944940 const ident_idx = header .name ;
945941 const ident_text = env .getIdentText (ident_idx );
946- if (std .mem .eql (u8 , ident_text , qualified_name )) {
942+ if (std .mem .eql (u8 , ident_text , type_name )) {
947943 return stmt_idx ;
948944 }
949945 },
0 commit comments