src/types.ts: Only make 'fn', 'struct' and 'type' introduce new types as declarations
This commit is contained in:
parent
0ae7fd565e
commit
5e7b344e49
1 changed files with 5 additions and 22 deletions
25
src/types.ts
25
src/types.ts
|
@ -1,6 +1,6 @@
|
|||
|
||||
import { FastStringMap, assert, isPlainObject, some, prettyPrintTag, map, flatMap, filter, memoize, comparator, createTransparentProxy, TransparentProxy, every, FastMultiMap, getKeyTag } from "./util";
|
||||
import { SyntaxKind, Syntax, isBoltTypeExpression, BoltExpression, BoltFunctionDeclaration, BoltFunctionBodyElement, kindToString, SourceFile, isBoltExpression, BoltCallExpression, BoltIdentifier, isBoltDeclarationLike, isBoltPattern, isJSExpression, isBoltStatement, isJSStatement, isJSPattern, isJSParameter, isBoltParameter, isBoltMatchArm, isBoltRecordField, isBoltRecordFieldPattern, isEndOfFile, isSyntax, } from "./ast";
|
||||
import { SyntaxKind, Syntax, isBoltTypeExpression, BoltExpression, BoltFunctionDeclaration, BoltFunctionBodyElement, kindToString, SourceFile, isBoltExpression, BoltCallExpression, BoltIdentifier, isBoltDeclarationLike, isBoltPattern, isJSExpression, isBoltStatement, isJSStatement, isJSPattern, isJSParameter, isBoltParameter, isBoltMatchArm, isBoltRecordField, isBoltRecordFieldPattern, isEndOfFile, isSyntax, isBoltFunctionDeclaration, isBoltTypeDeclaration, isBoltRecordDeclaration, } from "./ast";
|
||||
import { convertNodeToSymbolPath, ScopeType, SymbolResolver, SymbolInfo, SymbolPath } from "./resolver";
|
||||
import { Value, Record } from "./evaluator";
|
||||
import { getReturnStatementsInFunctionBody, getAllReturnStatementsInFunctionBody, getFullyQualifiedPathToNode, hasDiagnostic, hasTypeError } from "./common";
|
||||
|
@ -428,7 +428,9 @@ let nextRecordTypeId = 1;
|
|||
|
||||
function introducesType(node: Syntax) {
|
||||
return isBoltExpression(node)
|
||||
|| isBoltDeclarationLike(node)
|
||||
|| isBoltFunctionDeclaration(node)
|
||||
|| isBoltTypeDeclaration(node)
|
||||
|| isBoltRecordDeclaration(node)
|
||||
|| isBoltParameter(node)
|
||||
|| isBoltMatchArm(node)
|
||||
|| isBoltRecordField(node)
|
||||
|
@ -701,24 +703,6 @@ export class TypeChecker {
|
|||
|
||||
switch (node.kind) {
|
||||
|
||||
//case SyntaxKind.JSReturnStatement:
|
||||
//{
|
||||
// if (node.value === null) {
|
||||
// return this.getOpaqueType('undefined');
|
||||
// }
|
||||
// this.markNodeAsRequiringUpdate(node.value, node);
|
||||
// return node.value.type!.solved;
|
||||
//}
|
||||
|
||||
//case SyntaxKind.JSExpressionStatement:
|
||||
//{
|
||||
// if (node.expression === null) {
|
||||
// return new TupleType;
|
||||
// }
|
||||
// this.markNodeAsRequiringUpdate(node.expression, node);
|
||||
// return node.expression.type!.solved;
|
||||
//}
|
||||
|
||||
case SyntaxKind.JSMemberExpression:
|
||||
{
|
||||
// TODO
|
||||
|
@ -854,7 +838,6 @@ export class TypeChecker {
|
|||
|
||||
case SyntaxKind.BoltImplDeclaration:
|
||||
{
|
||||
// TODO
|
||||
return new AnyType;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue