compiler: correctly generate code for local named types

It is possible to create function-local named types:

    func foo() any {
        type named int
        return named(0)
    }

This patch makes sure they don't alias with named types declared at the
package scope.

Bug originally found by Damian Gryski while working on reflect support.
This commit is contained in:
Ayke van Laethem
2023-03-16 15:06:01 +01:00
committed by Ron Evans
parent 17f5fb1071
commit 523c6c0e3b
4 changed files with 116 additions and 24 deletions
+1
View File
@@ -71,6 +71,7 @@ type compilerContext struct {
difiles map[string]llvm.Metadata
ditypes map[types.Type]llvm.Metadata
llvmTypes typeutil.Map
interfaceTypes typeutil.Map
machine llvm.TargetMachine
targetData llvm.TargetData
intType llvm.Type