Fix assignment of type to a type expression in checker.ts

This commit is contained in:
Sam Vervaeck 2022-09-19 14:06:12 +02:00
parent 6af1fabb88
commit 4fed500ea3

View file

@ -1572,8 +1572,8 @@ export class Checker {
const scheme = this.lookup(node, Symkind.Type);
if (scheme === null) {
// this.diagnostics.add(new BindingNotFoudDiagnostic(node.name.text, node.name));
return this.createTypeVar();
}
type = this.createTypeVar();
} else {
type = this.instantiate(scheme, node.name);
// It is not guaranteed that `type` is copied during instantiation,
// so the following check ensures that we really are holding a copy
@ -1582,6 +1582,7 @@ export class Checker {
type = type.shallowClone();
}
type.node = node;
}
break;
}
@ -1592,7 +1593,8 @@ export class Checker {
}
case SyntaxKind.NestedTypeExpression:
return this.inferTypeExpression(node.typeExpr, introduceTypeVars);
type = this.inferTypeExpression(node.typeExpr, introduceTypeVars);
break;
case SyntaxKind.VarTypeExpression:
{