mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 22:13:39 +00:00
compiler: fix type names for generic named structs
Without this change, the compiler would probably have worked just fine but the generated types would look odd. You can see in the test case that it now doesn't use `main.Point` but rather the correct `main.Poin[float32]` etc.
This commit is contained in:
committed by
Ron Evans
parent
5078ce382d
commit
70c52ef1b4
@@ -393,7 +393,7 @@ func (c *compilerContext) makeLLVMType(goType types.Type) llvm.Type {
|
||||
// in LLVM IR, named structs are implemented as named structs in
|
||||
// LLVM. This is because it is otherwise impossible to create
|
||||
// self-referencing types such as linked lists.
|
||||
llvmName := typ.Obj().Pkg().Path() + "." + typ.Obj().Name()
|
||||
llvmName := typ.String()
|
||||
llvmType := c.ctx.StructCreateNamed(llvmName)
|
||||
c.llvmTypes.Set(goType, llvmType) // avoid infinite recursion
|
||||
underlying := c.getLLVMType(st)
|
||||
|
||||
Reference in New Issue
Block a user