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
27
src/types.ts
27
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 { 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 { convertNodeToSymbolPath, ScopeType, SymbolResolver, SymbolInfo, SymbolPath } from "./resolver";
|
||||||
import { Value, Record } from "./evaluator";
|
import { Value, Record } from "./evaluator";
|
||||||
import { getReturnStatementsInFunctionBody, getAllReturnStatementsInFunctionBody, getFullyQualifiedPathToNode, hasDiagnostic, hasTypeError } from "./common";
|
import { getReturnStatementsInFunctionBody, getAllReturnStatementsInFunctionBody, getFullyQualifiedPathToNode, hasDiagnostic, hasTypeError } from "./common";
|
||||||
|
@ -428,7 +428,9 @@ let nextRecordTypeId = 1;
|
||||||
|
|
||||||
function introducesType(node: Syntax) {
|
function introducesType(node: Syntax) {
|
||||||
return isBoltExpression(node)
|
return isBoltExpression(node)
|
||||||
|| isBoltDeclarationLike(node)
|
|| isBoltFunctionDeclaration(node)
|
||||||
|
|| isBoltTypeDeclaration(node)
|
||||||
|
|| isBoltRecordDeclaration(node)
|
||||||
|| isBoltParameter(node)
|
|| isBoltParameter(node)
|
||||||
|| isBoltMatchArm(node)
|
|| isBoltMatchArm(node)
|
||||||
|| isBoltRecordField(node)
|
|| isBoltRecordField(node)
|
||||||
|
@ -701,24 +703,6 @@ export class TypeChecker {
|
||||||
|
|
||||||
switch (node.kind) {
|
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:
|
case SyntaxKind.JSMemberExpression:
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -845,7 +829,7 @@ export class TypeChecker {
|
||||||
return new PlainRecordFieldType(node.name!.text, nestedFieldType);
|
return new PlainRecordFieldType(node.name!.text, nestedFieldType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case SyntaxKind.BoltTypeAliasDeclaration:
|
case SyntaxKind.BoltTypeAliasDeclaration:
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -854,7 +838,6 @@ export class TypeChecker {
|
||||||
|
|
||||||
case SyntaxKind.BoltImplDeclaration:
|
case SyntaxKind.BoltImplDeclaration:
|
||||||
{
|
{
|
||||||
// TODO
|
|
||||||
return new AnyType;
|
return new AnyType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue