Skip to content

Commit 98113ae

Browse files
authored
Merge pull request #1638 from goplus/xgopilot/issue-1636-1770954884
ssa: fix prog.Type error for instantiated generic types
2 parents dfc046d + 509d9f9 commit 98113ae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ssa/type_cvt.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ func Instantiate(orig types.Type, t *types.Named) (types.Type, bool) {
170170
for i := 0; i < tp.Len(); i++ {
171171
targs[i] = tp.At(i)
172172
}
173-
if typ, err := types.Instantiate(nil, orig, targs, true); err == nil {
173+
// Use validate=false because the newly created type parameters may not
174+
// match the original constraint references. The original type was already
175+
// validated by the Go type checker, so we can skip validation here.
176+
if typ, err := types.Instantiate(nil, orig, targs, false); err == nil {
174177
return typ, true
175178
}
176179
}

0 commit comments

Comments
 (0)