From 05b024c3f44b31a9bb2aaa2054bb143b959d9559 Mon Sep 17 00:00:00 2001 From: Sam Vervaeck Date: Wed, 27 May 2020 19:57:15 +0200 Subject: [PATCH] Update code base - Fix some issues in the parser and the AST spec - Fix invalid union types emitted by treegen - Fix and extend the Evaluator a bit - Swich API of type checker and make it store checking errors on the Syntax object itself --- src/ast-spec.txt | 19 +- src/ast.d.ts | 1250 +++++++++++++++++++++++++++++----- src/checks.ts | 197 ++++-- src/diagnostics.ts | 1 + src/emitter.ts | 6 +- src/evaluator.ts | 4 + src/frontend.ts | 3 +- src/parser.ts | 129 ++-- src/resolver.ts | 14 +- src/treegen/ast-template.js | 5 + src/treegen/ast.dts.template | 5 +- src/treegen/index.ts | 2 +- src/types.ts | 154 ++++- 13 files changed, 1461 insertions(+), 328 deletions(-) diff --git a/src/ast-spec.txt b/src/ast-spec.txt index dcf76d363..d7e479668 100644 --- a/src/ast-spec.txt +++ b/src/ast-spec.txt @@ -91,7 +91,8 @@ node BoltSourceFile > SourceFile { } node BoltQualName { - modulePath: Option, + isAbsolute: bool, + modulePath: Vec, name: BoltSymbol, } @@ -103,8 +104,7 @@ node BoltModulePath { node BoltTypeExpression; node BoltReferenceTypeExpression > BoltTypeExpression { - modulePath: Option, - name: BoltIdentifier, + name: BoltQualName, arguments: Option>, } @@ -113,6 +113,10 @@ node BoltFunctionTypeExpression > BoltTypeExpression { returnType: Option, } +node BoltLiftedTypeExpression > BoltTypeExpression { + expression: BoltExpression, +} + node BoltTypeParameter { index: usize, name: BoltIdentifier, @@ -166,8 +170,7 @@ node BoltTupleExpression > BoltExpression { } node BoltReferenceExpression > BoltExpression { - modulePath: Option, - name: BoltSymbol, + name: BoltQualName, } node BoltMemberExpression > BoltExpression { @@ -284,7 +287,8 @@ node BoltVariableDeclaration > BoltFunctionBodyElement, BoltDeclaration { node BoltImportSymbol; node BoltPlainImportSymbol > BoltImportSymbol { - name: BoltQualName, + remote: BoltQualName, + local: BoltSymbol, } node BoltImportDirective > BoltSourceElement { @@ -296,7 +300,8 @@ node BoltImportDirective > BoltSourceElement { node BoltExportSymbol; node BoltPlainExportSymbol { - name: BoltQualName, + local: BoltQualName, + remote: BoltSymbol, } node BoltExportDirective > BoltSourceElement { diff --git a/src/ast.d.ts b/src/ast.d.ts index 02f724460..e6ef1ea2d 100644 --- a/src/ast.d.ts +++ b/src/ast.d.ts @@ -1,5 +1,5 @@ -import { TypeInfo } from "./types" +import { Type } from "./checker" import { Package } from "./common" import { TextSpan } from "./text" @@ -12,7 +12,8 @@ export function isSyntax(value: any): value is Syntax; interface SyntaxBase { id: number; kind: SyntaxKind; - _typeInfo: TypeInfo; + type?: Type; + errors: CompileError[] parentNode: Syntax | null; span: TextSpan | null; visit(visitors: NodeVisitor[]): void; @@ -76,6 +77,7 @@ export class NodeVisitor { protected visitBoltModulePath?(node: BoltModulePath): void; protected visitBoltReferenceTypeExpression?(node: BoltReferenceTypeExpression): void; protected visitBoltFunctionTypeExpression?(node: BoltFunctionTypeExpression): void; + protected visitBoltLiftedTypeExpression?(node: BoltLiftedTypeExpression): void; protected visitBoltTypeParameter?(node: BoltTypeParameter): void; protected visitBoltBindPattern?(node: BoltBindPattern): void; protected visitBoltTypePattern?(node: BoltTypePattern): void; @@ -233,110 +235,111 @@ export const enum SyntaxKind { BoltModulePath = 56, BoltReferenceTypeExpression = 58, BoltFunctionTypeExpression = 59, - BoltTypeParameter = 60, - BoltBindPattern = 62, - BoltTypePattern = 63, - BoltExpressionPattern = 64, - BoltTuplePatternElement = 65, - BoltTuplePattern = 66, - BoltRecordFieldPattern = 67, - BoltRecordPattern = 68, - BoltQuoteExpression = 70, - BoltTupleExpression = 71, - BoltReferenceExpression = 72, - BoltMemberExpression = 73, - BoltFunctionExpression = 74, - BoltCallExpression = 75, - BoltYieldExpression = 76, - BoltMatchArm = 77, - BoltMatchExpression = 78, - BoltCase = 79, - BoltCaseExpression = 80, - BoltBlockExpression = 81, - BoltConstantExpression = 82, - BoltReturnStatement = 84, - BoltConditionalCase = 85, - BoltConditionalStatement = 86, - BoltResumeStatement = 87, - BoltExpressionStatement = 88, - BoltParameter = 89, - BoltModule = 93, - BoltFunctionDeclaration = 95, - BoltVariableDeclaration = 96, - BoltPlainImportSymbol = 98, - BoltImportDirective = 99, - BoltExportSymbol = 100, - BoltPlainExportSymbol = 101, - BoltExportDirective = 102, - BoltTraitDeclaration = 103, - BoltImplDeclaration = 104, - BoltTypeAliasDeclaration = 105, - BoltRecordField = 107, - BoltRecordDeclaration = 108, - BoltMacroCall = 110, - JSOperator = 113, - JSIdentifier = 114, - JSString = 115, - JSInteger = 116, - JSFromKeyword = 117, - JSReturnKeyword = 118, - JSTryKeyword = 119, - JSFinallyKeyword = 120, - JSCatchKeyword = 121, - JSImportKeyword = 122, - JSAsKeyword = 123, - JSConstKeyword = 124, - JSLetKeyword = 125, - JSExportKeyword = 126, - JSFunctionKeyword = 127, - JSWhileKeyword = 128, - JSForKeyword = 129, - JSCloseBrace = 130, - JSCloseBracket = 131, - JSCloseParen = 132, - JSOpenBrace = 133, - JSOpenBracket = 134, - JSOpenParen = 135, - JSSemi = 136, - JSComma = 137, - JSDot = 138, - JSDotDotDot = 139, - JSMulOp = 140, - JSAddOp = 141, - JSDivOp = 142, - JSSubOp = 143, - JSLtOp = 144, - JSGtOp = 145, - JSBOrOp = 146, - JSBXorOp = 147, - JSBAndOp = 148, - JSBNotOp = 149, - JSNotOp = 150, - JSBindPattern = 152, - JSConstantExpression = 154, - JSMemberExpression = 155, - JSCallExpression = 156, - JSBinaryExpression = 157, - JSUnaryExpression = 158, - JSNewExpression = 159, - JSSequenceExpression = 160, - JSConditionalExpression = 161, - JSLiteralExpression = 163, - JSReferenceExpression = 164, - JSCatchBlock = 168, - JSTryCatchStatement = 169, - JSExpressionStatement = 170, - JSConditionalCase = 171, - JSConditionalStatement = 172, - JSReturnStatement = 173, - JSParameter = 174, - JSImportStarBinding = 178, - JSImportAsBinding = 179, - JSImportDeclaration = 180, - JSFunctionDeclaration = 181, - JSArrowFunctionDeclaration = 182, - JSLetDeclaration = 183, - JSSourceFile = 184, + BoltLiftedTypeExpression = 60, + BoltTypeParameter = 61, + BoltBindPattern = 63, + BoltTypePattern = 64, + BoltExpressionPattern = 65, + BoltTuplePatternElement = 66, + BoltTuplePattern = 67, + BoltRecordFieldPattern = 68, + BoltRecordPattern = 69, + BoltQuoteExpression = 71, + BoltTupleExpression = 72, + BoltReferenceExpression = 73, + BoltMemberExpression = 74, + BoltFunctionExpression = 75, + BoltCallExpression = 76, + BoltYieldExpression = 77, + BoltMatchArm = 78, + BoltMatchExpression = 79, + BoltCase = 80, + BoltCaseExpression = 81, + BoltBlockExpression = 82, + BoltConstantExpression = 83, + BoltReturnStatement = 85, + BoltConditionalCase = 86, + BoltConditionalStatement = 87, + BoltResumeStatement = 88, + BoltExpressionStatement = 89, + BoltParameter = 90, + BoltModule = 94, + BoltFunctionDeclaration = 96, + BoltVariableDeclaration = 97, + BoltPlainImportSymbol = 99, + BoltImportDirective = 100, + BoltExportSymbol = 101, + BoltPlainExportSymbol = 102, + BoltExportDirective = 103, + BoltTraitDeclaration = 104, + BoltImplDeclaration = 105, + BoltTypeAliasDeclaration = 106, + BoltRecordField = 108, + BoltRecordDeclaration = 109, + BoltMacroCall = 111, + JSOperator = 114, + JSIdentifier = 115, + JSString = 116, + JSInteger = 117, + JSFromKeyword = 118, + JSReturnKeyword = 119, + JSTryKeyword = 120, + JSFinallyKeyword = 121, + JSCatchKeyword = 122, + JSImportKeyword = 123, + JSAsKeyword = 124, + JSConstKeyword = 125, + JSLetKeyword = 126, + JSExportKeyword = 127, + JSFunctionKeyword = 128, + JSWhileKeyword = 129, + JSForKeyword = 130, + JSCloseBrace = 131, + JSCloseBracket = 132, + JSCloseParen = 133, + JSOpenBrace = 134, + JSOpenBracket = 135, + JSOpenParen = 136, + JSSemi = 137, + JSComma = 138, + JSDot = 139, + JSDotDotDot = 140, + JSMulOp = 141, + JSAddOp = 142, + JSDivOp = 143, + JSSubOp = 144, + JSLtOp = 145, + JSGtOp = 146, + JSBOrOp = 147, + JSBXorOp = 148, + JSBAndOp = 149, + JSBNotOp = 150, + JSNotOp = 151, + JSBindPattern = 153, + JSConstantExpression = 155, + JSMemberExpression = 156, + JSCallExpression = 157, + JSBinaryExpression = 158, + JSUnaryExpression = 159, + JSNewExpression = 160, + JSSequenceExpression = 161, + JSConditionalExpression = 162, + JSLiteralExpression = 164, + JSReferenceExpression = 165, + JSCatchBlock = 169, + JSTryCatchStatement = 170, + JSExpressionStatement = 171, + JSConditionalCase = 172, + JSConditionalStatement = 173, + JSReturnStatement = 174, + JSParameter = 175, + JSImportStarBinding = 179, + JSImportAsBinding = 180, + JSImportDeclaration = 181, + JSFunctionDeclaration = 182, + JSArrowFunctionDeclaration = 183, + JSLetDeclaration = 184, + JSSourceFile = 185, } export interface EndOfFile extends SyntaxBase { @@ -351,6 +354,7 @@ export type EndOfFileParent export type EndOfFileAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -375,6 +379,13 @@ export type EndOfFileAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type EndOfFileChild @@ -543,6 +554,7 @@ export type BoltStringLiteralParent export type BoltStringLiteralAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -567,6 +579,13 @@ export type BoltStringLiteralAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltStringLiteralChild @@ -585,6 +604,7 @@ export type BoltIntegerLiteralParent export type BoltIntegerLiteralAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -609,6 +629,13 @@ export type BoltIntegerLiteralAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltIntegerLiteralChild @@ -633,22 +660,26 @@ export interface BoltIdentifier extends SyntaxBase { export type BoltIdentifierParent = BoltQualName | BoltQuoteExpression -| BoltReferenceExpression | BoltFunctionDeclaration +| BoltPlainImportSymbol +| BoltPlainExportSymbol | never export type BoltIdentifierAnyParent = BoltQualName | BoltQuoteExpression -| BoltReferenceExpression | BoltFunctionDeclaration +| BoltPlainImportSymbol +| BoltPlainExportSymbol +| BoltImportDirective | BoltSourceFile +| BoltModule | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase -| BoltModule | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -665,6 +696,13 @@ export type BoltIdentifierAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltIdentifierChild @@ -687,22 +725,26 @@ export interface BoltOperator extends SyntaxBase { export type BoltOperatorParent = BoltQualName | BoltQuoteExpression -| BoltReferenceExpression | BoltFunctionDeclaration +| BoltPlainImportSymbol +| BoltPlainExportSymbol | never export type BoltOperatorAnyParent = BoltQualName | BoltQuoteExpression -| BoltReferenceExpression | BoltFunctionDeclaration +| BoltPlainImportSymbol +| BoltPlainExportSymbol +| BoltImportDirective | BoltSourceFile +| BoltModule | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase -| BoltModule | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -719,6 +761,13 @@ export type BoltOperatorAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltOperatorChild @@ -737,6 +786,7 @@ export type BoltAssignmentParent export type BoltAssignmentAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -761,6 +811,13 @@ export type BoltAssignmentAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltAssignmentChild @@ -778,6 +835,7 @@ export type BoltCommaParent export type BoltCommaAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -802,6 +860,13 @@ export type BoltCommaAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltCommaChild @@ -819,6 +884,7 @@ export type BoltSemiParent export type BoltSemiAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -843,6 +909,13 @@ export type BoltSemiAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltSemiChild @@ -860,6 +933,7 @@ export type BoltColonParent export type BoltColonAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -884,6 +958,13 @@ export type BoltColonAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltColonChild @@ -901,6 +982,7 @@ export type BoltColonColonParent export type BoltColonColonAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -925,6 +1007,13 @@ export type BoltColonColonAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltColonColonChild @@ -942,6 +1031,7 @@ export type BoltDotParent export type BoltDotAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -966,6 +1056,13 @@ export type BoltDotAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltDotChild @@ -983,6 +1080,7 @@ export type BoltDotDotParent export type BoltDotDotAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1007,6 +1105,13 @@ export type BoltDotDotAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltDotDotChild @@ -1024,6 +1129,7 @@ export type BoltRArrowParent export type BoltRArrowAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1048,6 +1154,13 @@ export type BoltRArrowAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltRArrowChild @@ -1065,6 +1178,7 @@ export type BoltRArrowAltParent export type BoltRArrowAltAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1089,6 +1203,13 @@ export type BoltRArrowAltAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltRArrowAltChild @@ -1106,6 +1227,7 @@ export type BoltLArrowParent export type BoltLArrowAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1130,6 +1252,13 @@ export type BoltLArrowAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltLArrowChild @@ -1147,6 +1276,7 @@ export type BoltEqSignParent export type BoltEqSignAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1171,6 +1301,13 @@ export type BoltEqSignAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltEqSignChild @@ -1185,22 +1322,26 @@ export interface BoltGtSign extends SyntaxBase { export type BoltGtSignParent = BoltQualName | BoltQuoteExpression -| BoltReferenceExpression | BoltFunctionDeclaration +| BoltPlainImportSymbol +| BoltPlainExportSymbol | never export type BoltGtSignAnyParent = BoltQualName | BoltQuoteExpression -| BoltReferenceExpression | BoltFunctionDeclaration +| BoltPlainImportSymbol +| BoltPlainExportSymbol +| BoltImportDirective | BoltSourceFile +| BoltModule | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase -| BoltModule | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1217,6 +1358,13 @@ export type BoltGtSignAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltGtSignChild @@ -1231,22 +1379,26 @@ export interface BoltExMark extends SyntaxBase { export type BoltExMarkParent = BoltQualName | BoltQuoteExpression -| BoltReferenceExpression | BoltFunctionDeclaration +| BoltPlainImportSymbol +| BoltPlainExportSymbol | never export type BoltExMarkAnyParent = BoltQualName | BoltQuoteExpression -| BoltReferenceExpression | BoltFunctionDeclaration +| BoltPlainImportSymbol +| BoltPlainExportSymbol +| BoltImportDirective | BoltSourceFile +| BoltModule | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase -| BoltModule | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1263,6 +1415,13 @@ export type BoltExMarkAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltExMarkChild @@ -1277,22 +1436,26 @@ export interface BoltLtSign extends SyntaxBase { export type BoltLtSignParent = BoltQualName | BoltQuoteExpression -| BoltReferenceExpression | BoltFunctionDeclaration +| BoltPlainImportSymbol +| BoltPlainExportSymbol | never export type BoltLtSignAnyParent = BoltQualName | BoltQuoteExpression -| BoltReferenceExpression | BoltFunctionDeclaration +| BoltPlainImportSymbol +| BoltPlainExportSymbol +| BoltImportDirective | BoltSourceFile +| BoltModule | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase -| BoltModule | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1309,6 +1472,13 @@ export type BoltLtSignAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltLtSignChild @@ -1323,22 +1493,26 @@ export interface BoltVBar extends SyntaxBase { export type BoltVBarParent = BoltQualName | BoltQuoteExpression -| BoltReferenceExpression | BoltFunctionDeclaration +| BoltPlainImportSymbol +| BoltPlainExportSymbol | never export type BoltVBarAnyParent = BoltQualName | BoltQuoteExpression -| BoltReferenceExpression | BoltFunctionDeclaration +| BoltPlainImportSymbol +| BoltPlainExportSymbol +| BoltImportDirective | BoltSourceFile +| BoltModule | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase -| BoltModule | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1355,6 +1529,13 @@ export type BoltVBarAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltVBarChild @@ -1395,6 +1576,7 @@ export type BoltWhereKeywordParent export type BoltWhereKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1419,6 +1601,13 @@ export type BoltWhereKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltWhereKeywordChild @@ -1436,6 +1625,7 @@ export type BoltQuoteKeywordParent export type BoltQuoteKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1460,6 +1650,13 @@ export type BoltQuoteKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltQuoteKeywordChild @@ -1477,6 +1674,7 @@ export type BoltFnKeywordParent export type BoltFnKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1501,6 +1699,13 @@ export type BoltFnKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltFnKeywordChild @@ -1518,6 +1723,7 @@ export type BoltForeignKeywordParent export type BoltForeignKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1542,6 +1748,13 @@ export type BoltForeignKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltForeignKeywordChild @@ -1559,6 +1772,7 @@ export type BoltForKeywordParent export type BoltForKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1583,6 +1797,13 @@ export type BoltForKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltForKeywordChild @@ -1600,6 +1821,7 @@ export type BoltLetKeywordParent export type BoltLetKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1624,6 +1846,13 @@ export type BoltLetKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltLetKeywordChild @@ -1641,6 +1870,7 @@ export type BoltReturnKeywordParent export type BoltReturnKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1665,6 +1895,13 @@ export type BoltReturnKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltReturnKeywordChild @@ -1682,6 +1919,7 @@ export type BoltLoopKeywordParent export type BoltLoopKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1706,6 +1944,13 @@ export type BoltLoopKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltLoopKeywordChild @@ -1723,6 +1968,7 @@ export type BoltYieldKeywordParent export type BoltYieldKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1747,6 +1993,13 @@ export type BoltYieldKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltYieldKeywordChild @@ -1764,6 +2017,7 @@ export type BoltMatchKeywordParent export type BoltMatchKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1788,6 +2042,13 @@ export type BoltMatchKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltMatchKeywordChild @@ -1805,6 +2066,7 @@ export type BoltImportKeywordParent export type BoltImportKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1829,6 +2091,13 @@ export type BoltImportKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltImportKeywordChild @@ -1846,6 +2115,7 @@ export type BoltExportKeywordParent export type BoltExportKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1870,6 +2140,13 @@ export type BoltExportKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltExportKeywordChild @@ -1887,6 +2164,7 @@ export type BoltPubKeywordParent export type BoltPubKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1911,6 +2189,13 @@ export type BoltPubKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltPubKeywordChild @@ -1928,6 +2213,7 @@ export type BoltModKeywordParent export type BoltModKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1952,6 +2238,13 @@ export type BoltModKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltModKeywordChild @@ -1969,6 +2262,7 @@ export type BoltMutKeywordParent export type BoltMutKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -1993,6 +2287,13 @@ export type BoltMutKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltMutKeywordChild @@ -2010,6 +2311,7 @@ export type BoltEnumKeywordParent export type BoltEnumKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2034,6 +2336,13 @@ export type BoltEnumKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltEnumKeywordChild @@ -2051,6 +2360,7 @@ export type BoltStructKeywordParent export type BoltStructKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2075,6 +2385,13 @@ export type BoltStructKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltStructKeywordChild @@ -2092,6 +2409,7 @@ export type BoltTypeKeywordParent export type BoltTypeKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2116,6 +2434,13 @@ export type BoltTypeKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltTypeKeywordChild @@ -2133,6 +2458,7 @@ export type BoltTraitKeywordParent export type BoltTraitKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2157,6 +2483,13 @@ export type BoltTraitKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltTraitKeywordChild @@ -2174,6 +2507,7 @@ export type BoltImplKeywordParent export type BoltImplKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2198,6 +2532,13 @@ export type BoltImplKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltImplKeywordChild @@ -2222,6 +2563,7 @@ export type BoltParenthesizedParent export type BoltParenthesizedAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2246,6 +2588,13 @@ export type BoltParenthesizedAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltParenthesizedChild @@ -2264,6 +2613,7 @@ export type BoltBracedParent export type BoltBracedAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2288,6 +2638,13 @@ export type BoltBracedAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltBracedChild @@ -2306,6 +2663,7 @@ export type BoltBracketedParent export type BoltBracketedAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2330,6 +2688,13 @@ export type BoltBracketedAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltBracketedChild @@ -2354,7 +2719,8 @@ export type BoltSourceFileChild export interface BoltQualName extends SyntaxBase { kind: SyntaxKind.BoltQualName; - modulePath: BoltModulePath | null; + isAbsolute: boolean; + modulePath: BoltIdentifier[]; name: BoltSymbol; parentNode: BoltQualNameParent; getChildNodes(): IterableIterator @@ -2389,12 +2755,12 @@ export type BoltModulePathChild export type BoltTypeExpression = BoltReferenceTypeExpression | BoltFunctionTypeExpression + | BoltLiftedTypeExpression export interface BoltReferenceTypeExpression extends SyntaxBase { kind: SyntaxKind.BoltReferenceTypeExpression; - modulePath: BoltModulePath | null; - name: BoltIdentifier; + name: BoltQualName; arguments: BoltTypeExpression[] | null; parentNode: BoltReferenceTypeExpressionParent; getChildNodes(): IterableIterator @@ -2433,6 +2799,7 @@ export type BoltReferenceTypeExpressionAnyParent | BoltTraitDeclaration | BoltBlockExpression | BoltConditionalCase +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2492,6 +2859,7 @@ export type BoltFunctionTypeExpressionAnyParent | BoltTraitDeclaration | BoltBlockExpression | BoltConditionalCase +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2510,6 +2878,65 @@ export type BoltFunctionTypeExpressionAnyParent export type BoltFunctionTypeExpressionChild = never +export interface BoltLiftedTypeExpression extends SyntaxBase { + kind: SyntaxKind.BoltLiftedTypeExpression; + expression: BoltExpression; + parentNode: BoltLiftedTypeExpressionParent; + getChildNodes(): IterableIterator +} + +export type BoltLiftedTypeExpressionParent += BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltTypePattern +| BoltRecordPattern +| BoltFunctionExpression +| BoltParameter +| BoltFunctionDeclaration +| BoltVariableDeclaration +| BoltImplDeclaration +| BoltTypeAliasDeclaration +| BoltRecordField +| never + +export type BoltLiftedTypeExpressionAnyParent += BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltTypePattern +| BoltRecordPattern +| BoltFunctionExpression +| BoltParameter +| BoltFunctionDeclaration +| BoltVariableDeclaration +| BoltImplDeclaration +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration +| BoltSourceFile +| BoltModule +| BoltTraitDeclaration +| BoltBlockExpression +| BoltConditionalCase +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltLiftedTypeExpressionChild += never + export interface BoltTypeParameter extends SyntaxBase { kind: SyntaxKind.BoltTypeParameter; index: number; @@ -2568,6 +2995,7 @@ export type BoltBindPatternAnyParent | BoltFunctionDeclaration | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2578,6 +3006,13 @@ export type BoltBindPatternAnyParent | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltBindPatternChild @@ -2614,6 +3049,7 @@ export type BoltTypePatternAnyParent | BoltFunctionDeclaration | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2624,6 +3060,13 @@ export type BoltTypePatternAnyParent | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltTypePatternChild @@ -2660,6 +3103,7 @@ export type BoltExpressionPatternAnyParent | BoltFunctionDeclaration | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -2669,6 +3113,13 @@ export type BoltExpressionPatternAnyParent | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltExpressionPatternChild @@ -2722,6 +3173,7 @@ export type BoltTuplePatternAnyParent | BoltFunctionDeclaration | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2732,6 +3184,13 @@ export type BoltTuplePatternAnyParent | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltTuplePatternChild @@ -2787,6 +3246,7 @@ export type BoltRecordPatternAnyParent | BoltFunctionDeclaration | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -2797,6 +3257,12 @@ export type BoltRecordPatternAnyParent | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltRecordPatternChild @@ -2819,13 +3285,14 @@ export type BoltExpression export interface BoltQuoteExpression extends SyntaxBase { kind: SyntaxKind.BoltQuoteExpression; - tokens: Token | BoltExpression[]; + tokens: (Token | BoltExpression)[]; parentNode: BoltQuoteExpressionParent; getChildNodes(): IterableIterator } export type BoltQuoteExpressionParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -2842,7 +3309,8 @@ export type BoltQuoteExpressionParent | never export type BoltQuoteExpressionAnyParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -2866,6 +3334,13 @@ export type BoltQuoteExpressionAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltQuoteExpressionChild @@ -2879,7 +3354,8 @@ export interface BoltTupleExpression extends SyntaxBase { } export type BoltTupleExpressionParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -2896,7 +3372,8 @@ export type BoltTupleExpressionParent | never export type BoltTupleExpressionAnyParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltMemberExpression | BoltCallExpression | BoltYieldExpression @@ -2919,6 +3396,13 @@ export type BoltTupleExpressionAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltTupleExpressionChild @@ -2926,14 +3410,14 @@ export type BoltTupleExpressionChild export interface BoltReferenceExpression extends SyntaxBase { kind: SyntaxKind.BoltReferenceExpression; - modulePath: BoltModulePath | null; - name: BoltSymbol; + name: BoltQualName; parentNode: BoltReferenceExpressionParent; getChildNodes(): IterableIterator } export type BoltReferenceExpressionParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -2950,7 +3434,8 @@ export type BoltReferenceExpressionParent | never export type BoltReferenceExpressionAnyParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -2974,6 +3459,13 @@ export type BoltReferenceExpressionAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltReferenceExpressionChild @@ -2988,7 +3480,8 @@ export interface BoltMemberExpression extends SyntaxBase { } export type BoltMemberExpressionParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3005,7 +3498,8 @@ export type BoltMemberExpressionParent | never export type BoltMemberExpressionAnyParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltCallExpression | BoltYieldExpression @@ -3028,6 +3522,13 @@ export type BoltMemberExpressionAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltMemberExpressionChild @@ -3043,7 +3544,8 @@ export interface BoltFunctionExpression extends SyntaxBase { } export type BoltFunctionExpressionParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3060,7 +3562,8 @@ export type BoltFunctionExpressionParent | never export type BoltFunctionExpressionAnyParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3083,6 +3586,13 @@ export type BoltFunctionExpressionAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltFunctionExpressionChild @@ -3097,7 +3607,8 @@ export interface BoltCallExpression extends SyntaxBase { } export type BoltCallExpressionParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3114,7 +3625,8 @@ export type BoltCallExpressionParent | never export type BoltCallExpressionAnyParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltYieldExpression @@ -3137,6 +3649,13 @@ export type BoltCallExpressionAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltCallExpressionChild @@ -3150,7 +3669,8 @@ export interface BoltYieldExpression extends SyntaxBase { } export type BoltYieldExpressionParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3167,7 +3687,8 @@ export type BoltYieldExpressionParent | never export type BoltYieldExpressionAnyParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3190,6 +3711,13 @@ export type BoltYieldExpressionAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltYieldExpressionChild @@ -3221,7 +3749,8 @@ export interface BoltMatchExpression extends SyntaxBase { } export type BoltMatchExpressionParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3238,7 +3767,8 @@ export type BoltMatchExpressionParent | never export type BoltMatchExpressionAnyParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3261,6 +3791,13 @@ export type BoltMatchExpressionAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltMatchExpressionChild @@ -3291,7 +3828,8 @@ export interface BoltCaseExpression extends SyntaxBase { } export type BoltCaseExpressionParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3308,7 +3846,8 @@ export type BoltCaseExpressionParent | never export type BoltCaseExpressionAnyParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3332,6 +3871,13 @@ export type BoltCaseExpressionAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltCaseExpressionChild @@ -3345,7 +3891,8 @@ export interface BoltBlockExpression extends SyntaxBase { } export type BoltBlockExpressionParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3362,7 +3909,8 @@ export type BoltBlockExpressionParent | never export type BoltBlockExpressionAnyParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3385,6 +3933,13 @@ export type BoltBlockExpressionAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltBlockExpressionChild @@ -3398,7 +3953,8 @@ export interface BoltConstantExpression extends SyntaxBase { } export type BoltConstantExpressionParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3415,7 +3971,8 @@ export type BoltConstantExpressionParent | never export type BoltConstantExpressionAnyParent -= BoltExpressionPattern += BoltLiftedTypeExpression +| BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression @@ -3439,6 +3996,13 @@ export type BoltConstantExpressionAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltConstantExpressionChild @@ -3477,6 +4041,7 @@ export type BoltReturnStatementAnyParent | BoltFunctionDeclaration | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -3492,6 +4057,13 @@ export type BoltReturnStatementAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltReturnStatementChild @@ -3539,6 +4111,7 @@ export type BoltConditionalStatementAnyParent | BoltFunctionDeclaration | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -3555,6 +4128,13 @@ export type BoltConditionalStatementAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltConditionalStatementChild @@ -3585,6 +4165,7 @@ export type BoltResumeStatementAnyParent | BoltFunctionDeclaration | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -3600,6 +4181,13 @@ export type BoltResumeStatementAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltResumeStatementChild @@ -3630,6 +4218,7 @@ export type BoltExpressionStatementAnyParent | BoltFunctionDeclaration | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -3645,6 +4234,13 @@ export type BoltExpressionStatementAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltExpressionStatementChild @@ -3751,6 +4347,7 @@ export type BoltFunctionDeclarationAnyParent | BoltModule | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -3767,6 +4364,13 @@ export type BoltFunctionDeclarationAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltFunctionDeclarationChild @@ -3802,6 +4406,7 @@ export type BoltVariableDeclarationAnyParent | BoltFunctionDeclaration | BoltTraitDeclaration | BoltImplDeclaration +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -3817,6 +4422,13 @@ export type BoltVariableDeclarationAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type BoltVariableDeclarationChild @@ -3828,7 +4440,8 @@ export type BoltImportSymbol export interface BoltPlainImportSymbol extends SyntaxBase { kind: SyntaxKind.BoltPlainImportSymbol; - name: BoltQualName; + remote: BoltQualName; + local: BoltSymbol; parentNode: BoltPlainImportSymbolParent; getChildNodes(): IterableIterator } @@ -3885,7 +4498,8 @@ export type BoltExportSymbolChild export interface BoltPlainExportSymbol extends SyntaxBase { kind: SyntaxKind.BoltPlainExportSymbol; - name: BoltQualName; + local: BoltQualName; + remote: BoltSymbol; parentNode: BoltPlainExportSymbolParent; getChildNodes(): IterableIterator } @@ -4082,6 +4696,7 @@ export interface BoltMacroCall extends SyntaxBase { export type BoltMacroCallParent = BoltSourceFile +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4107,6 +4722,7 @@ export type BoltMacroCallParent export type BoltMacroCallAnyParent = BoltSourceFile +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4131,6 +4747,12 @@ export type BoltMacroCallAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField | never export type BoltMacroCallChild @@ -4191,6 +4813,7 @@ export type JSOperatorParent export type JSOperatorAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4215,6 +4838,13 @@ export type JSOperatorAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSOperatorChild @@ -4233,6 +4863,7 @@ export type JSIdentifierParent export type JSIdentifierAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4257,6 +4888,13 @@ export type JSIdentifierAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSIdentifierChild @@ -4275,6 +4913,7 @@ export type JSStringParent export type JSStringAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4299,6 +4938,13 @@ export type JSStringAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSStringChild @@ -4317,6 +4963,7 @@ export type JSIntegerParent export type JSIntegerAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4341,6 +4988,13 @@ export type JSIntegerAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSIntegerChild @@ -4358,6 +5012,7 @@ export type JSFromKeywordParent export type JSFromKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4382,6 +5037,13 @@ export type JSFromKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSFromKeywordChild @@ -4399,6 +5061,7 @@ export type JSReturnKeywordParent export type JSReturnKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4423,6 +5086,13 @@ export type JSReturnKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSReturnKeywordChild @@ -4440,6 +5110,7 @@ export type JSTryKeywordParent export type JSTryKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4464,6 +5135,13 @@ export type JSTryKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSTryKeywordChild @@ -4481,6 +5159,7 @@ export type JSFinallyKeywordParent export type JSFinallyKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4505,6 +5184,13 @@ export type JSFinallyKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSFinallyKeywordChild @@ -4522,6 +5208,7 @@ export type JSCatchKeywordParent export type JSCatchKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4546,6 +5233,13 @@ export type JSCatchKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSCatchKeywordChild @@ -4563,6 +5257,7 @@ export type JSImportKeywordParent export type JSImportKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4587,6 +5282,13 @@ export type JSImportKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSImportKeywordChild @@ -4604,6 +5306,7 @@ export type JSAsKeywordParent export type JSAsKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4628,6 +5331,13 @@ export type JSAsKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSAsKeywordChild @@ -4645,6 +5355,7 @@ export type JSConstKeywordParent export type JSConstKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4669,6 +5380,13 @@ export type JSConstKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSConstKeywordChild @@ -4686,6 +5404,7 @@ export type JSLetKeywordParent export type JSLetKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4710,6 +5429,13 @@ export type JSLetKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSLetKeywordChild @@ -4727,6 +5453,7 @@ export type JSExportKeywordParent export type JSExportKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4751,6 +5478,13 @@ export type JSExportKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSExportKeywordChild @@ -4768,6 +5502,7 @@ export type JSFunctionKeywordParent export type JSFunctionKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4792,6 +5527,13 @@ export type JSFunctionKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSFunctionKeywordChild @@ -4809,6 +5551,7 @@ export type JSWhileKeywordParent export type JSWhileKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4833,6 +5576,13 @@ export type JSWhileKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSWhileKeywordChild @@ -4850,6 +5600,7 @@ export type JSForKeywordParent export type JSForKeywordAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4874,6 +5625,13 @@ export type JSForKeywordAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSForKeywordChild @@ -4891,6 +5649,7 @@ export type JSCloseBraceParent export type JSCloseBraceAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4915,6 +5674,13 @@ export type JSCloseBraceAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSCloseBraceChild @@ -4932,6 +5698,7 @@ export type JSCloseBracketParent export type JSCloseBracketAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4956,6 +5723,13 @@ export type JSCloseBracketAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSCloseBracketChild @@ -4973,6 +5747,7 @@ export type JSCloseParenParent export type JSCloseParenAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -4997,6 +5772,13 @@ export type JSCloseParenAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSCloseParenChild @@ -5014,6 +5796,7 @@ export type JSOpenBraceParent export type JSOpenBraceAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5038,6 +5821,13 @@ export type JSOpenBraceAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSOpenBraceChild @@ -5055,6 +5845,7 @@ export type JSOpenBracketParent export type JSOpenBracketAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5079,6 +5870,13 @@ export type JSOpenBracketAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSOpenBracketChild @@ -5096,6 +5894,7 @@ export type JSOpenParenParent export type JSOpenParenAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5120,6 +5919,13 @@ export type JSOpenParenAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSOpenParenChild @@ -5137,6 +5943,7 @@ export type JSSemiParent export type JSSemiAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5161,6 +5968,13 @@ export type JSSemiAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSSemiChild @@ -5178,6 +5992,7 @@ export type JSCommaParent export type JSCommaAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5202,6 +6017,13 @@ export type JSCommaAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSCommaChild @@ -5219,6 +6041,7 @@ export type JSDotParent export type JSDotAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5243,6 +6066,13 @@ export type JSDotAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSDotChild @@ -5260,6 +6090,7 @@ export type JSDotDotDotParent export type JSDotDotDotAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5284,6 +6115,13 @@ export type JSDotDotDotAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSDotDotDotChild @@ -5301,6 +6139,7 @@ export type JSMulOpParent export type JSMulOpAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5325,6 +6164,13 @@ export type JSMulOpAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSMulOpChild @@ -5342,6 +6188,7 @@ export type JSAddOpParent export type JSAddOpAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5366,6 +6213,13 @@ export type JSAddOpAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSAddOpChild @@ -5383,6 +6237,7 @@ export type JSDivOpParent export type JSDivOpAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5407,6 +6262,13 @@ export type JSDivOpAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSDivOpChild @@ -5424,6 +6286,7 @@ export type JSSubOpParent export type JSSubOpAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5448,6 +6311,13 @@ export type JSSubOpAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSSubOpChild @@ -5465,6 +6335,7 @@ export type JSLtOpParent export type JSLtOpAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5489,6 +6360,13 @@ export type JSLtOpAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSLtOpChild @@ -5506,6 +6384,7 @@ export type JSGtOpParent export type JSGtOpAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5530,6 +6409,13 @@ export type JSGtOpAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSGtOpChild @@ -5547,6 +6433,7 @@ export type JSBOrOpParent export type JSBOrOpAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5571,6 +6458,13 @@ export type JSBOrOpAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSBOrOpChild @@ -5588,6 +6482,7 @@ export type JSBXorOpParent export type JSBXorOpAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5612,6 +6507,13 @@ export type JSBXorOpAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSBXorOpChild @@ -5629,6 +6531,7 @@ export type JSBAndOpParent export type JSBAndOpAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5653,6 +6556,13 @@ export type JSBAndOpAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSBAndOpChild @@ -5670,6 +6580,7 @@ export type JSBNotOpParent export type JSBNotOpAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5694,6 +6605,13 @@ export type JSBNotOpAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSBNotOpChild @@ -5711,6 +6629,7 @@ export type JSNotOpParent export type JSNotOpAnyParent = BoltQuoteExpression +| BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression @@ -5735,6 +6654,13 @@ export type JSNotOpAnyParent | BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern +| BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltRecordPattern +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration | never export type JSNotOpChild @@ -6639,6 +7565,7 @@ export type BoltSyntax | BoltModulePath | BoltReferenceTypeExpression | BoltFunctionTypeExpression + | BoltLiftedTypeExpression | BoltTypeParameter | BoltBindPattern | BoltTypePattern @@ -6798,6 +7725,7 @@ export type Syntax | BoltModulePath | BoltReferenceTypeExpression | BoltFunctionTypeExpression + | BoltLiftedTypeExpression | BoltTypeParameter | BoltBindPattern | BoltTypePattern @@ -6951,10 +7879,11 @@ export function createBoltParenthesized(text: string, span?: TextSpan | null): B export function createBoltBraced(text: string, span?: TextSpan | null): BoltBraced; export function createBoltBracketed(text: string, span?: TextSpan | null): BoltBracketed; export function createBoltSourceFile(elements: BoltSourceElement[], package: Package, span?: TextSpan | null): BoltSourceFile; -export function createBoltQualName(modulePath: BoltModulePath | null, name: BoltSymbol, span?: TextSpan | null): BoltQualName; +export function createBoltQualName(isAbsolute: boolean, modulePath: BoltIdentifier[], name: BoltSymbol, span?: TextSpan | null): BoltQualName; export function createBoltModulePath(isAbsolute: boolean, elements: BoltIdentifier[], span?: TextSpan | null): BoltModulePath; -export function createBoltReferenceTypeExpression(modulePath: BoltModulePath | null, name: BoltIdentifier, arguments: BoltTypeExpression[] | null, span?: TextSpan | null): BoltReferenceTypeExpression; +export function createBoltReferenceTypeExpression(name: BoltQualName, arguments: BoltTypeExpression[] | null, span?: TextSpan | null): BoltReferenceTypeExpression; export function createBoltFunctionTypeExpression(params: BoltParameter[], returnType: BoltTypeExpression | null, span?: TextSpan | null): BoltFunctionTypeExpression; +export function createBoltLiftedTypeExpression(expression: BoltExpression, span?: TextSpan | null): BoltLiftedTypeExpression; export function createBoltTypeParameter(index: number, name: BoltIdentifier, typeNode: BoltTypeExpression | null, defaultType: BoltTypeExpression | null, span?: TextSpan | null): BoltTypeParameter; export function createBoltBindPattern(name: BoltIdentifier, span?: TextSpan | null): BoltBindPattern; export function createBoltTypePattern(type: BoltTypeExpression, nestedPattern: BoltPattern, span?: TextSpan | null): BoltTypePattern; @@ -6963,9 +7892,9 @@ export function createBoltTuplePatternElement(index: number, pattern: BoltPatter export function createBoltTuplePattern(elements: BoltTuplePatternElement[], span?: TextSpan | null): BoltTuplePattern; export function createBoltRecordFieldPattern(isRest: boolean, name: BoltIdentifier | null, pattern: BoltPattern | null, span?: TextSpan | null): BoltRecordFieldPattern; export function createBoltRecordPattern(name: BoltTypeExpression, fields: BoltRecordFieldPattern[], span?: TextSpan | null): BoltRecordPattern; -export function createBoltQuoteExpression(tokens: Token | BoltExpression[], span?: TextSpan | null): BoltQuoteExpression; +export function createBoltQuoteExpression(tokens: (Token | BoltExpression)[], span?: TextSpan | null): BoltQuoteExpression; export function createBoltTupleExpression(elements: BoltExpression[], span?: TextSpan | null): BoltTupleExpression; -export function createBoltReferenceExpression(modulePath: BoltModulePath | null, name: BoltSymbol, span?: TextSpan | null): BoltReferenceExpression; +export function createBoltReferenceExpression(name: BoltQualName, span?: TextSpan | null): BoltReferenceExpression; export function createBoltMemberExpression(expression: BoltExpression, path: BoltIdentifier[], span?: TextSpan | null): BoltMemberExpression; export function createBoltFunctionExpression(params: BoltParameter[], returnType: BoltTypeExpression | null, body: BoltFunctionBodyElement[], span?: TextSpan | null): BoltFunctionExpression; export function createBoltCallExpression(operator: BoltExpression, operands: BoltExpression[], span?: TextSpan | null): BoltCallExpression; @@ -6985,10 +7914,10 @@ export function createBoltParameter(index: number, bindings: BoltPattern, type: export function createBoltModule(modifiers: BoltModifiers, name: BoltIdentifier[], elements: BoltSourceElement[], span?: TextSpan | null): BoltModule; export function createBoltFunctionDeclaration(modifiers: BoltModifiers, target: string, name: BoltSymbol, params: BoltParameter[], returnType: BoltTypeExpression | null, typeParams: BoltTypeParameter[] | null, body: BoltFunctionBodyElement[], span?: TextSpan | null): BoltFunctionDeclaration; export function createBoltVariableDeclaration(modifiers: BoltModifiers, bindings: BoltPattern, type: BoltTypeExpression | null, value: BoltExpression | null, span?: TextSpan | null): BoltVariableDeclaration; -export function createBoltPlainImportSymbol(name: BoltQualName, span?: TextSpan | null): BoltPlainImportSymbol; +export function createBoltPlainImportSymbol(remote: BoltQualName, local: BoltSymbol, span?: TextSpan | null): BoltPlainImportSymbol; export function createBoltImportDirective(modifiers: BoltModifiers, file: BoltStringLiteral, symbols: BoltImportSymbol[], span?: TextSpan | null): BoltImportDirective; export function createBoltExportSymbol(span?: TextSpan | null): BoltExportSymbol; -export function createBoltPlainExportSymbol(name: BoltQualName, span?: TextSpan | null): BoltPlainExportSymbol; +export function createBoltPlainExportSymbol(local: BoltQualName, remote: BoltSymbol, span?: TextSpan | null): BoltPlainExportSymbol; export function createBoltExportDirective(file: string, symbols: BoltExportSymbol[] | null, span?: TextSpan | null): BoltExportDirective; export function createBoltTraitDeclaration(modifiers: BoltModifiers, name: BoltIdentifier, typeParams: BoltTypeParameter[] | null, elements: BoltDeclaration[], span?: TextSpan | null): BoltTraitDeclaration; export function createBoltImplDeclaration(modifiers: BoltModifiers, name: BoltIdentifier, trait: BoltTypeExpression, typeParams: BoltTypeParameter[] | null, elements: BoltDeclaration[], span?: TextSpan | null): BoltImplDeclaration; @@ -7117,6 +8046,7 @@ export function isBoltModulePath(value: any): value is BoltModulePath; export function isBoltTypeExpression(value: any): value is BoltTypeExpression; export function isBoltReferenceTypeExpression(value: any): value is BoltReferenceTypeExpression; export function isBoltFunctionTypeExpression(value: any): value is BoltFunctionTypeExpression; +export function isBoltLiftedTypeExpression(value: any): value is BoltLiftedTypeExpression; export function isBoltTypeParameter(value: any): value is BoltTypeParameter; export function isBoltPattern(value: any): value is BoltPattern; export function isBoltBindPattern(value: any): value is BoltBindPattern; diff --git a/src/checks.ts b/src/checks.ts index 7b7d330cd..97b343e14 100644 --- a/src/checks.ts +++ b/src/checks.ts @@ -1,13 +1,14 @@ -import { BoltImportDirective, Syntax, BoltParameter, BoltModulePath, BoltReferenceExpression, BoltReferenceTypeExpression, BoltSourceFile, BoltCallExpression, BoltReturnKeyword, BoltReturnStatement, SyntaxKind, NodeVisitor } from "./ast"; +import { BoltImportDirective, Syntax, BoltParameter, BoltModulePath, BoltReferenceExpression, BoltReferenceTypeExpression, BoltSourceFile, BoltCallExpression, BoltReturnKeyword, BoltReturnStatement, SyntaxKind, NodeVisitor, BoltSyntax, BoltIdentifier } from "./ast"; import { Program } from "./program"; -import { DiagnosticPrinter, E_FILE_NOT_FOUND, E_TYPES_NOT_ASSIGNABLE, E_DECLARATION_NOT_FOUND, E_TYPE_DECLARATION_NOT_FOUND, E_MUST_RETURN_A_VALUE } from "./diagnostics"; +import { DiagnosticPrinter, E_FILE_NOT_FOUND, E_TYPES_NOT_ASSIGNABLE, E_DECLARATION_NOT_FOUND, E_TYPE_DECLARATION_NOT_FOUND, E_MUST_RETURN_A_VALUE, E_MAY_NOT_RETURN_A_VALUE } from "./diagnostics"; import { getSymbolPathFromNode } from "./resolver" -import { inject } from "./di"; +import { inject } from "./ioc"; import { SymbolResolver, ScopeType } from "./resolver"; -import { assert } from "./util"; +import { assert, every } from "./util"; import { emitNode } from "./emitter"; -import { TypeChecker, Type } from "./types"; +import { TypeChecker, Type, ErrorType } from "./types"; import { getReturnStatementsInFunctionBody } from "./common"; +import { errorMonitor } from "events"; export class CheckInvalidFilePaths extends NodeVisitor { @@ -41,24 +42,65 @@ export class CheckReferences extends NodeVisitor { super(); } - private checkBoltModulePath(node: BoltModulePath, symbolKind: ScopeType) { - const scope = this.resolver.getScopeForNode(node, symbolKind); - assert(scope !== null); - const sym = this.resolver.resolveModulePath(node.elements.map(el => el.text), scope!); - if (sym === null) { + private checkBoltModulePath(node: BoltSyntax, elements: BoltIdentifier[]) { + + let modScope = this.resolver.getScopeForNode(node, ScopeType.Module); + assert(modScope !== null); + let foundModule = false; + let partiallyMatchingModules = []; + + // We will keep looping until we are at the topmost module of + // the package corresponding to `node`. + while (true) { + + let failedToFindScope = false; + let currScope = modScope; + + // Go through each of the parent names in normal order, resolving to the module + // that declared the name, and mark when we failed to look up the inner module. + for (const name of elements) { + const sym = currScope!.getLocalSymbol(name.text);; + if (sym === null) { + failedToFindScope = true; + partiallyMatchingModules.push((currScope!.source) as NodeScopeSource).node); + break; + } + assert(every(sym.declarations.values(), decl => decl.kind === SyntaxKind.BoltModule)); + currScope = sym.scope; + } + + // If the previous loop did not fail, that means we found a module. + if (!failedToFindScope) { + foundModule = true; + break; + } + + // We continue the outer loop by going up one scope. + const nextScope = modScope!.getNextScope(); + + // If we are here and there are no scopes left to search in, then no scope had the given module. + if (nextScope === null) { + break; + } + + modScope = nextScope; + + } + + if (!foundModule) { this.diagnostics.add({ message: E_DECLARATION_NOT_FOUND, severity: 'error', args: { name: emitNode(node) }, node, }); + // TODO add informational diagnostics about the modules that provided a partial match } + } protected visitBoltReferenceExpression(node: BoltReferenceExpression) { - if (node.modulePath !== null) { - this.checkBoltModulePath(node.modulePath, ScopeType.Variable); - } + this.checkBoltModulePath(node.name, node.name.modulePath); const scope = this.resolver.getScopeSurroundingNode(node, ScopeType.Variable); assert(scope !== null); const resolvedSym = this.resolver.resolveSymbolPath(getSymbolPathFromNode(node), scope!); @@ -75,14 +117,14 @@ export class CheckReferences extends NodeVisitor { protected visitBoltReferenceTypeExpression(node: BoltReferenceTypeExpression) { const scope = this.resolver.getScopeForNode(node, ScopeType.Type); assert(scope !== null); - const symbolPath = getSymbolPathFromNode(node.path); + const symbolPath = getSymbolPathFromNode(node.name); const resolvedSym = this.resolver.resolveSymbolPath(symbolPath, scope!); if (resolvedSym === null) { this.diagnostics.add({ message: E_TYPE_DECLARATION_NOT_FOUND, - args: { name: emitNode(node.path) }, + args: { name: emitNode(node.name) }, severity: 'error', - node: node.path, + node: node.name, }) } } @@ -92,59 +134,86 @@ export class CheckReferences extends NodeVisitor { export class CheckTypeAssignments extends NodeVisitor { - constructor( - @inject private diagnostics: DiagnosticPrinter, - @inject private checker: TypeChecker, - ) { + constructor(@inject private diagnostics: DiagnosticPrinter) { super(); } - protected visitBoltReturnStatement(node: BoltReturnStatement) { - - const fnDecl = node.getParentOfKind(SyntaxKind.BoltFunctionDeclaration)!; - - if (node.value === null) { - if (fnDecl.returnType !== null && this.checker.isVoid(fnDecl.returnType)) { - this.diagnostics.add({ - message: E_MUST_RETURN_A_VALUE, - node, - severity: 'error', - }); - } - } else { - for (const error of this.checker.getAssignmentErrors(fnDecl.returnType, node.value)) { - this.diagnostics.add({ - message: E_MUST_RETURN_A_VALUE, - node: node, - severity: 'error', - }); - } - } - - } - - protected visitBoltParameter(node: BoltParameter) { - if (node.defaultValue !== null) { - for (const error of this.checker.getAssignmentErrors(node.bindings, node.defaultValue)) { - this.diagnostics.add({ - severity: 'error', - message: E_TYPES_NOT_ASSIGNABLE, - args: { node: error.node } - }); - } - } - } - - protected visitBoltCallExpression(node: BoltCallExpression) { - for (const fnDecl of this.checker.getCallableFunctions(node)) { - for (const error of this.checker.getAssignmentErrors(fnDecl, node)) { - this.diagnostics.add({ - severity: 'error', - message: E_TYPES_NOT_ASSIGNABLE, - args: { node: error.node }, - }); + protected visitSyntax(node: Syntax) { + for (const error of node.errors) { + switch (error.type) { + case ErrorType.AssignmentError: + this.diagnostics.add({ + message: E_TYPES_NOT_ASSIGNABLE, + severity: 'error', + node: error.left, + }); + default: + throw new Error(`Could not add a diagnostic message for the error ${ErrorType[error.type]}`) } } } } + +//export class CheckTypeAssignments extends NodeVisitor { + +// constructor( +// @inject private diagnostics: DiagnosticPrinter, +// @inject private checker: TypeChecker, +// ) { +// super(); +// } + +// protected visitBoltReturnStatement(node: BoltReturnStatement) { + +// const fnDecl = node.getParentOfKind(SyntaxKind.BoltFunctionDeclaration)!; + +// if ((this.checker.isVoidType(node) && !this.checker.isVoidType(fnDecl)) { +// this.diagnostics.add({ +// message: E_MUST_RETURN_A_VALUE, +// node: node.value !== null ? node.value : node, +// severity: 'error', +// }); +// } else if (!this.checker.isVoidType(node) && this.checker.isVoidType(fnDecl)) { +// this.diagnostics.add({ +// message: E_MAY_NOT_RETURN_A_VALUE, +// node: node.value !== null ? node.value : node, +// severity: 'error', +// }) +// } else { +// for (const error of this.checker.checkAssignment(fnDecl, node)) { +// this.diagnostics.add({ +// message: E_TYPES_NOT_ASSIGNABLE, +// node: error.node, +// severity: 'error', +// }); +// } +// } + +// } + +// protected visitBoltParameter(node: BoltParameter) { +// if (node.defaultValue !== null) { +// for (const error of this.checker.checkAssignment(node.bindings, node.defaultValue)) { +// this.diagnostics.add({ +// severity: 'error', +// message: E_TYPES_NOT_ASSIGNABLE, +// node: error.node, +// }); +// } +// } +// } + +// protected visitBoltCallExpression(node: BoltCallExpression) { +// for (const fnDecl of this.checker.getCallableFunctions(node)) { +// for (const error of this.checker.checkAssignment(fnDecl, node)) { +// this.diagnostics.add({ +// severity: 'error', +// message: E_TYPES_NOT_ASSIGNABLE, +// node: error.node, +// }); +// } +// } +// } + +//} diff --git a/src/diagnostics.ts b/src/diagnostics.ts index 9a4be6dc9..62d71deec 100644 --- a/src/diagnostics.ts +++ b/src/diagnostics.ts @@ -3,6 +3,7 @@ import chalk from "chalk" import {Syntax} from "./ast"; import {format, MapLike, FormatArg, countDigits} from "./util"; +export const E_MAY_NOT_RETURN_A_VALUE = "Returning a value inside a function that does not return values." export const E_MUST_RETURN_A_VALUE = "The function must return a value on all control paths.";;;; export const E_FILE_NOT_FOUND = "A file named {filename} was not found."; export const E_FIELD_HAS_INVALID_VERSION_NUMBER = "Field '{name}' contains an invalid version nunmber." diff --git a/src/emitter.ts b/src/emitter.ts index 7094921d7..3846ac756 100644 --- a/src/emitter.ts +++ b/src/emitter.ts @@ -15,11 +15,11 @@ export class Emitter { case SyntaxKind.BoltQualName: if (node.modulePath !== null) { - if (node.modulePath.isAbsolute) { + if (node.isAbsolute) { out += '::' } - for (const element of node.modulePath.elements) { - out += '::' + element.text; + for (const element of node.modulePath) { + out += element.text + '::'; } } out += this.emit(node.name); diff --git a/src/evaluator.ts b/src/evaluator.ts index 1e94111fa..015269368 100644 --- a/src/evaluator.ts +++ b/src/evaluator.ts @@ -12,6 +12,10 @@ export class Record { this.fields = new Map(fields); } + public getFields(): IterableIterator<[string, Value]> { + return this.fields[Symbol.iterator](); + } + public clone(): Record { return new Record(this.fields); } diff --git a/src/frontend.ts b/src/frontend.ts index 844d3201b..fd35d3c99 100644 --- a/src/frontend.ts +++ b/src/frontend.ts @@ -93,7 +93,8 @@ export class Frontend { const checkers = checks.map(check => container.createInstance(check)); for (const sourceFile of program.getAllSourceFiles()) { - resolver.registerSourceFile(sourceFile as BoltSourceFile); + checker.registerSourceFile(sourceFile); + resolver.registerSourceFile(sourceFile); } for (const sourceFile of program.getAllSourceFiles()) { sourceFile.visit(checkers) diff --git a/src/parser.ts b/src/parser.ts index 91f3e9cd3..2c440840b 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -80,6 +80,7 @@ import { createBoltModulePath, BoltModulePath, isBoltSymbol, + BoltIdentifierChild, } from "./ast" import { parseForeignLanguage } from "./foreign" @@ -109,8 +110,7 @@ function assertNoTokens(tokens: BoltTokenStream) { } } -const KIND_SYMBOL = [ - SyntaxKind.BoltIdentifier, +const KIND_OPERATOR = [ SyntaxKind.BoltOperator, SyntaxKind.BoltVBar, SyntaxKind.BoltLtSign, @@ -124,7 +124,8 @@ const KIND_EXPRESSION_T0 = uniq([ SyntaxKind.BoltMatchKeyword, SyntaxKind.BoltQuoteKeyword, SyntaxKind.BoltYieldKeyword, - ...KIND_SYMBOL, + SyntaxKind.BoltIdentifier, + SyntaxKind.BoltParenthesized, ]) const KIND_STATEMENT_T0 = uniq([ @@ -239,17 +240,41 @@ export class Parser { public parseQualName(tokens: BoltTokenStream): BoltQualName { - let modulePath = null; - if (tokens.peek(2).kind === SyntaxKind.BoltDot) { - modulePath = this.parseModulePath(tokens); + const firstToken = tokens.peek(); + let isAbsolute = false; + let modulePath = []; + let name; + if (tokens.peek().kind === SyntaxKind.BoltColonColon) { + isAbsolute = true; + tokens.get(); } - const name = tokens.get(); - assertToken(name, SyntaxKind.BoltIdentifier); - const startNode = modulePath !== null ? modulePath : name; - const endNode = name; - const node = createBoltQualName(modulePath, name as BoltIdentifier, null); - setOrigNodeRange(node, startNode, endNode); + while (true) { + const t1 = tokens.get(); + if (tokens.peek().kind === SyntaxKind.BoltColonColon) { + assertToken(t1, SyntaxKind.BoltIdentifier); + modulePath.push(t1 as BoltIdentifier); + tokens.get(); + } else { + if (t1.kind === SyntaxKind.BoltParenthesized) { + const innerTokens = createTokenStream(t1); + const t2 = innerTokens.get(); + if (!isBoltOperatorLike(t2)) { + throw new ParseError(t2, KIND_OPERATOR); + } + assertNoTokens(innerTokens); + name = t2; + } else if (t1.kind === SyntaxKind.BoltIdentifier) { + name = t1; + } else { + throw new ParseError(t1, [SyntaxKind.BoltParenthesized, SyntaxKind.BoltIdentifier]); + } + break; + } + } + + const node = createBoltQualName(isAbsolute, modulePath, name as BoltIdentifier, null); + setOrigNodeRange(node, firstToken, name); return node; } @@ -395,15 +420,29 @@ export class Parser { public parseReferenceTypeExpression(tokens: BoltTokenStream): BoltReferenceTypeExpression { const firstToken = tokens.peek(); - let modulePath = null; - if (tokens.peek(2).kind === SyntaxKind.BoltColonColon) { - modulePath = this.parseModulePath(tokens) + let isAbsolute = false; + let modulePath = []; + let name; + + if (tokens.peek().kind === SyntaxKind.BoltColonColon) { + isAbsolute = true; + tokens.get(); } - const t1 = tokens.get(); - assertToken(t1, SyntaxKind.BoltIdentifier); - let lastToken = t1; + while (true) { + const t1 = tokens.get(); + if (tokens.peek().kind === SyntaxKind.BoltColonColon) { + assertToken(t1, SyntaxKind.BoltIdentifier); + modulePath.push(t1 as BoltIdentifier); + tokens.get(); + } else { + assertToken(t1, SyntaxKind.BoltIdentifier); + name = t1 as BoltIdentifier; + break; + } + } + let lastToken: BoltToken = name; let typeArgs: BoltTypeExpression[] | null = null; if (tokens.peek().kind === SyntaxKind.BoltLtSign) { @@ -428,7 +467,9 @@ export class Parser { lastToken = t4; } - const node = createBoltReferenceTypeExpression(modulePath, t1 as BoltIdentifier, typeArgs); + const qualName = createBoltQualName(isAbsolute, modulePath, name); + setOrigNodeRange(qualName, firstToken, modulePath.length > 0 ? modulePath[modulePath.length-1] : firstToken) + const node = createBoltReferenceTypeExpression(qualName, typeArgs); setOrigNodeRange(node, firstToken, lastToken); return node; } @@ -536,35 +577,10 @@ export class Parser { } public parseReferenceExpression(tokens: BoltTokenStream): BoltReferenceExpression { - const firstToken = tokens.peek(); - let isAbsolute = false; - let elements = []; - - while (true) { - const t2 = tokens.peek(2); - if (t2.kind !== SyntaxKind.BoltColonColon) { - break; - } - const t1 = tokens.get(); - assertToken(t1, SyntaxKind.BoltIdentifier); - elements.push(t1 as BoltIdentifier) - tokens.get(); - } - - let path = null; - if (elements.length > 0) { - path = createBoltModulePath(isAbsolute, elements); - setOrigNodeRange(path, elements[0], elements[elements.length-1]); - } - - const t3 = tokens.get(); - assertToken(t3, SyntaxKind.BoltIdentifier); - - // TODO Add support for parsing parenthesized operators - - const node = createBoltReferenceExpression(path, t3 as BoltIdentifier); - setOrigNodeRange(node, firstToken, t3); + const name = this.parseQualName(tokens); + const node = createBoltReferenceExpression(name); + setOrigNodeRange(node, firstToken, name); return node; } @@ -631,7 +647,7 @@ export class Parser { } scanned.push(t2); } - const result = createBoltQuoteExpression(scanned); + const result = createBoltQuoteExpression(scanned as Token[]); setOrigNodeRange(result, t0, t1); return result; } @@ -967,6 +983,7 @@ export class Parser { public parseModuleDeclaration(tokens: BoltTokenStream): BoltModule { let modifiers = 0; + let pathElements = []; let t0 = tokens.get(); const firstToken = t0; @@ -979,16 +996,24 @@ export class Parser { throw new ParseError(t0, [SyntaxKind.BoltModKeyword]) } - // FIXME should fail to parse absolute paths - const name = this.parseModulePath(tokens); + while (true) { + const t1 = tokens.get(); + assertToken(t1, SyntaxKind.BoltIdentifier) + pathElements.push(t1 as BoltIdentifier) + const t2 = tokens.peek(); + if (t2.kind !== SyntaxKind.BoltColonColon) { + break; + } + tokens.get(); + } const t1 = tokens.get(); if (t1.kind !== SyntaxKind.BoltBraced) { throw new ParseError(t1, [SyntaxKind.BoltBraced]) } - const sentences = this.parseSourceElements(createTokenStream(t1)); + const elements = this.parseSourceElements(createTokenStream(t1)); - const node = createBoltModule(modifiers, name.elements, sentences); + const node = createBoltModule(modifiers, pathElements, elements); setOrigNodeRange(node, firstToken, t1); return node; } diff --git a/src/resolver.ts b/src/resolver.ts index 2ac105516..90e38fb21 100644 --- a/src/resolver.ts +++ b/src/resolver.ts @@ -30,8 +30,8 @@ export function getSymbolPathFromNode(node: BoltSyntax): SymbolPath { switch (node.kind) { case SyntaxKind.BoltReferenceExpression: return new SymbolPath( - node.modulePath === null ? [] : node.modulePath.elements.map(id => id.text), - node.modulePath !== null && node.modulePath.isAbsolute, + node.name.modulePath.map(id => id.text), + node.name.isAbsolute, emitNode(node.name), ); case SyntaxKind.BoltIdentifier: @@ -41,7 +41,7 @@ export function getSymbolPathFromNode(node: BoltSyntax): SymbolPath { if (node.modulePath === null) { return new SymbolPath([], false, name); } - return new SymbolPath(node.modulePath.elements.map(id => id.text), false, name); + return new SymbolPath(node.modulePath.map(id => id.text), false, name); case SyntaxKind.BoltModulePath: return new SymbolPath( node.elements.slice(0, -1).map(el => el.text), @@ -104,7 +104,7 @@ class NodeScopeSource implements ScopeSource { interface ResolutionStrategy { getSymbolName(node: Syntax): string; - getScopeType(node: Syntax): ScopeType; + getScopeTypes(node: Syntax): ScopeType[]; getNextScopeSource(source: ScopeSource, kind: ScopeType): ScopeSource | null; } @@ -425,12 +425,12 @@ export class SymbolResolver { } } - public getScopeSurroundingNode(node: Syntax, kind: ScopeType = this.strategy.getScopeType(node)): Scope | null { + public getScopeSurroundingNode(node: Syntax, kind: ScopeType): Scope | null { assert(node.parentNode !== null); return this.getScopeForNode(node.parentNode!, kind); } - public getScopeForNode(node: Syntax, kind: ScopeType = this.strategy.getScopeType(node)): Scope | null { + public getScopeForNode(node: Syntax, kind: ScopeType): Scope | null { let source: ScopeSource = new NodeScopeSource(node); if (!this.strategy.introducesNewScope(source, kind)) { const nextSource = this.strategy.getNextScopeSource(source, kind); @@ -482,7 +482,7 @@ export class SymbolResolver { return null; } - public getSymbolForNode(node: Syntax, kind: ScopeType = this.strategy.getScopeType(node)) { + public getSymbolForNode(node: Syntax, kind: ScopeType) { assert(this.strategy.hasSymbol(node)); const scope = this.getScopeForNode(node, kind); if (scope === null) { diff --git a/src/treegen/ast-template.js b/src/treegen/ast-template.js index 84b589195..cfb2a9011 100644 --- a/src/treegen/ast-template.js +++ b/src/treegen/ast-template.js @@ -117,6 +117,11 @@ function createNode(nodeType) { return this.__NODE_TYPE.index; } }); + Object.defineProperty(obj, 'errors', { + enumerable: false, + configurable: true, + value: [], + }) Object.defineProperty(obj, 'id', { enumerable: true, configurable: true, diff --git a/src/treegen/ast.dts.template b/src/treegen/ast.dts.template index 2bd21fd76..42e4826b4 100644 --- a/src/treegen/ast.dts.template +++ b/src/treegen/ast.dts.template @@ -1,5 +1,5 @@ -import { TypeInfo } from "./types" +import { Type } from "./checker" import { Package } from "./common" import { TextSpan } from "./text" @@ -12,7 +12,8 @@ export function isSyntax(value: any): value is Syntax; interface SyntaxBase { id: number; kind: SyntaxKind; - _typeInfo: TypeInfo; + type?: Type; + errors: CompileError[] parentNode: Syntax | null; span: TextSpan | null; visit(visitors: NodeVisitor[]): void; diff --git a/src/treegen/index.ts b/src/treegen/index.ts index 29aaed719..85675ac8f 100644 --- a/src/treegen/index.ts +++ b/src/treegen/index.ts @@ -356,7 +356,7 @@ export function generateAST(decls: Declaration[]) { throw new Error(`Could not emit TypeScript type for reference type node named ${typeNode.name}`); } } else if (typeNode.type === 'UnionTypeNode') { - return typeNode.elements.map(emitTypeScriptType).join(' | '); + return '(' + typeNode.elements.map(emitTypeScriptType).join(' | ') + ')'; } throw new Error(`Could not emit TypeScript type for type node ${typeNode}`); } diff --git a/src/types.ts b/src/types.ts index 88d7d559d..8b8c99f40 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,8 +1,12 @@ import { FastStringMap, assert, isPlainObject } from "./util"; -import { SyntaxKind, Syntax, isBoltTypeExpression, BoltExpression, BoltFunctionDeclaration, BoltFunctionBodyElement, kindToString } from "./ast"; +import { SyntaxKind, Syntax, isBoltTypeExpression, BoltExpression, BoltFunctionDeclaration, BoltFunctionBodyElement, kindToString, SourceFile, isBoltExpression, isBoltMacroCall, BoltTypeExpression } from "./ast"; import { getSymbolPathFromNode, ScopeType, SymbolResolver, SymbolInfo } from "./resolver"; -import { Value } from "./evaluator"; +import { Value, Record } from "./evaluator"; + +// TODO For function bodies, we can do something special. +// Sort the return types and find the largest types, eliminating types that fall under other types. +// Next, add the resulting types as type hints to `fnReturnType`. enum TypeKind { OpaqueType, @@ -24,6 +28,7 @@ export type Type | RecordType | VariantType | TupleType + | UnionType abstract class TypeBase { @@ -91,6 +96,18 @@ export class UnionType extends TypeBase { public kind: TypeKind.UnionType = TypeKind.UnionType; + constructor(private elements: Type[] = []) { + super(); + } + + public addElement(element: Type): void { + this.elements.push(element); + } + + public getElements(): IterableIterator { + return this.elements[Symbol.iterator](); + } + } export type RecordFieldType @@ -140,6 +157,19 @@ export class RecordType { } +export enum ErrorType { + AssignmentError, +} + +interface AssignmentError { + type: ErrorType.AssignmentError; + left: Syntax; + right: Syntax; +} + +export type CompileError + = AssignmentError + export class TupleType extends TypeBase { kind: TypeKind.TupleType = TypeKind.TupleType; @@ -180,17 +210,17 @@ export class TupleType extends TypeBase { // return new NeverType(); //} -interface AssignmentError { - node: Syntax; -} - export class TypeChecker { private opaqueTypes = new FastStringMap(); + private anyType = new AnyType(); private stringType = new OpaqueType(); private intType = new OpaqueType(); private floatType = new OpaqueType(); + private voidType = new OpaqueType(); + + private syntaxType = new UnionType(); // FIXME constructor(private resolver: SymbolResolver) { @@ -203,10 +233,10 @@ export class TypeChecker { return this.intType; } else if (typeof(value) === 'number') { return this.floatType; - } else if (isPlainObject(value)) { + } else if (value instanceof Record) { const recordType = new RecordType() - for (const key of Object.keys(value)) { - recordType.addField(key, new PlainRecordFieldType(this.getTypeOfValue(value[key]))); + for (const [fieldName, fieldValue] of value.getFields()) { + recordType.addField(name, new PlainRecordFieldType(this.getTypeOfValue(fieldValue))); } return recordType; } else { @@ -214,46 +244,108 @@ export class TypeChecker { } } - public getTypeOfNode(node: Syntax) { + public registerSourceFile(sourceFile: SourceFile): void { + for (const node of sourceFile.preorder()) { + if (isBoltMacroCall(node)) { + continue; // FIXME only continue when we're not in an expression context + } + if (isBoltExpression(node)) { + node.type = this.createInitialTypeForExpression(node); + } + } + } + + private createInitialTypeForExpression(node: Syntax): Type { + + if (node.type !== undefined) { + return node.type; + } + + let resultType; switch (node.kind) { + case SyntaxKind.BoltMatchExpression: + { + const unionType = new UnionType(); + for (const matchArm of node.arms) { + unionType.addElement(this.createInitialTypeForExpression(matchArm.body)); + } + resultType = unionType; + break; + } + case SyntaxKind.BoltRecordDeclaration: { - const recordSym = this.resolver.getSymbolForNode(node); + const recordSym = this.resolver.getSymbolForNode(node, ScopeType.Type); assert(recordSym !== null); if (this.opaqueTypes.has(recordSym!.id)) { - return this.opaqueTypes.get(recordSym!.id); + resultType = this.opaqueTypes.get(recordSym!.id); + } else { + const opaqueType = new OpaqueType(recordSym!); + this.opaqueTypes.set(recordSym!.id, opaqueType); + resultType = opaqueType; } - const opaqueType = new OpaqueType(recordSym!); - this.opaqueTypes.set(recordSym!.id, opaqueType); + break; + } + + case SyntaxKind.BoltFunctionExpression: + { + const paramTypes = node.params.map(param => { + if (param.type === null) { + return this.anyType; + } + return this.createInitialTypeForTypeExpression(param.type); + }); + let returnType = node.returnType === null + ? this.anyType + : this.createInitialTypeForTypeExpression(node.returnType); + const funcType = new FunctionType(paramTypes, returnType); + break; + } + + case SyntaxKind.BoltQuoteExpression: + return this.syntaxType; + + case SyntaxKind.BoltMemberExpression: + case SyntaxKind.BoltReferenceExpression: + case SyntaxKind.BoltCallExpression: + case SyntaxKind.BoltBlockExpression: + { + resultType = this.anyType; break; } case SyntaxKind.BoltConstantExpression: - return this.getTypeOfValue(node.value); + { + resultType = this.getTypeOfValue(node.value); + break; + } - } - - } - - public isVoid(node: Syntax): boolean { - switch (node.kind) { - case SyntaxKind.BoltTupleExpression: - return node.elements.length === 0; default: - throw new Error(`Could not determine whether the given type resolves to the void type.`) + throw new Error(`Could not create a type for node ${kindToString(node.kind)}.`); + + } + + node.type = resultType; + + return resultType; + + } + + private createInitialTypeForTypeExpression(node: BoltTypeExpression): Type { + switch (node.kind) { + case SyntaxKind.BoltLiftedTypeExpression: + return this.createInitialTypeForExpression(node.expression); + default: + throw new Error(`Could not create a type for node ${kindToString(node.kind)}.`); } } - public *getAssignmentErrors(left: Syntax, right: Syntax): IterableIterator { - - // TODO For function bodies, we can do something special. - // Sort the return types and find the largest types, eliminating types that fall under other types. - // Next, add the resulting types as type hints to `fnReturnType`. - + public isVoidType(type: Type): boolean { + return type === this.voidType; } - + public getCallableFunctions(node: BoltExpression): BoltFunctionDeclaration[] { const resolver = this.resolver;