diff --git a/src/cmd/compile/internal/types2/typexpr.go b/src/cmd/compile/internal/types2/typexpr.go index 8accc46751fdd0..73565191f7a9ad 100644 --- a/src/cmd/compile/internal/types2/typexpr.go +++ b/src/cmd/compile/internal/types2/typexpr.go @@ -194,7 +194,7 @@ func (check *Checker) validVarType(e syntax.Expr, typ Type) { func (check *Checker) definedType(e syntax.Expr, def *TypeName) Type { typ := check.typInternal(e, def) assert(isTyped(typ)) - if isGeneric(typ) { + if isGeneric(typ) && isValid(typ) { check.errorf(e, WrongTypeArgCount, "cannot use generic type %s without instantiation", typ) typ = Typ[Invalid] } diff --git a/test/fixedbugs/issue74725.go b/test/fixedbugs/issue74725.go new file mode 100644 index 00000000000000..ded00fa0d8fc8d --- /dev/null +++ b/test/fixedbugs/issue74725.go @@ -0,0 +1,6 @@ +// errorcheck + +package main + +type a = b[int] // ERROR "invalid recursive type a\n.*a refers to b\n.*b refers to a" +type b[_ any] = a \ No newline at end of file