diff --git a/effect/packages/package1/src/type-driven-overloads/op1.ts b/effect/packages/package1/src/type-driven-overloads/op1.ts
index a56801384fe..8acb04a374b 100644
--- a/effect/packages/package1/src/type-driven-overloads/op1.ts
+++ b/effect/packages/package1/src/type-driven-overloads/op1.ts
@@ -7,9 +7,6 @@ import { T } from './T.js'
* @tsplus operator T + 0.1
*/
export function op1_(_self: T, x: string): T
-/**
- * Comment 2
- */
export function op1_(_self: T, x: boolean): T
export function op1_(_self: T, x: string | boolean): T {
return { value: x.toString() }
diff --git a/effect/packages/package1/tsconfig.json b/effect/packages/package1/tsconfig.json
index 46c3a1f8b52..9f4f5a85b8a 100644
--- a/effect/packages/package1/tsconfig.json
+++ b/effect/packages/package1/tsconfig.json
@@ -5,7 +5,9 @@
"declarationDir": "build/dts",
"declarationMap": true,
"tsPlusConfig": "../../tsplus.config.json",
- "rootDir": "src"
+ "rootDir": "src",
+ "incremental": true,
+ "tsBuildInfoFile": "build/.tsbuildinfo"
},
"include": ["src/**/*.ts"]
}
\ No newline at end of file
diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts
index 4b7defd38b0..c828b9a9380 100644
--- a/src/compiler/builderState.ts
+++ b/src/compiler/builderState.ts
@@ -225,8 +225,18 @@ namespace ts {
}
// TSPLUS START
- for (const file of arrayFrom(program.getTypeChecker().getTsPlusFiles().values())) {
- addReferencedFile(file.resolvedPath);
+ program.getTypeChecker().getTsPlusFiles().get(sourceFile)?.forEach((file) => {
+ if (file !== sourceFile) {
+ addReferencedFile(file.resolvedPath);
+ }
+ })
+ if (!sourceFile.isDeclarationFile) {
+ program.getTypeChecker().getTsPlusGlobalImports().forEach((imp) => {
+ const file = getSourceFileOfNode(imp.declaration);
+ if (file !== sourceFile) {
+ addReferencedFile(file.resolvedPath);
+ }
+ })
}
// TSPLUS END
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 4ce9702842e..9bafa79d0f9 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -387,7 +387,8 @@ namespace ts {
const unificationInProgress = {
isRunning: false
};
- const tsPlusFiles = new Set();
+ const tsPlusFiles = new Map>();
+ const tsPlusFilesFinal = new Map>();
// TSPLUS EXTENSION END
// Cancellation that controls whether or not we can cancel in the middle of type checking.
@@ -829,9 +830,12 @@ namespace ts {
collectTsPlusFluentTags,
hasExportedPlusTags: (declaration) => {
return collectTsPlusFluentTags(declaration).length > 0 ||
+ collectTsPlusPipeableTags(declaration).length > 0 ||
collectTsPlusGetterTags(declaration).length > 0 ||
+ collectTsPlusIndexTags(declaration).length > 0 ||
+ collectTsPlusPipeableIndexTags(declaration).length > 0 ||
collectTsPlusOperatorTags(declaration).length > 0 ||
- collectTsPlusPipeableTags(declaration).length > 0 ||
+ collectTsPlusPipeableOperatorTags(declaration).length > 0 ||
collectTsPlusStaticTags(declaration).length > 0 ||
isTsPlusImplicit(declaration) ||
collectTsPlusDeriveTags(declaration).length > 0
@@ -913,7 +917,8 @@ namespace ts {
.concat(collectTsPlusGetterTags(node))
.concat(collectTsPlusOperatorTags(node))
},
- getTsPlusFiles: () => tsPlusFiles
+ getTsPlusFiles: () => tsPlusFilesFinal,
+ getTsPlusGlobalImports: () => tsPlusGlobalImportCache
// TSPLUS EXTENSION END
};
@@ -46606,7 +46611,6 @@ namespace ts {
function cacheTsPlusType(declaration: InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration): void {
const type = getTypeOfNode(declaration);
for (const typeTag of collectTsPlusTypeTags(declaration)) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
if (type === globalStringType) {
addToTypeSymbolCache(tsplusStringPrimitiveSymbol, typeTag, "after");
}
@@ -46691,12 +46695,15 @@ namespace ts {
}
}
}
+ function getTsPlusSourceFileCache(tag: string) {
+ return tsPlusFiles.has(tag) ? tsPlusFiles.get(tag)! : (tsPlusFiles.set(tag, new Set()), tsPlusFiles.get(tag)!);
+ }
function cacheTsPlusCompanion(declaration: ClassDeclaration): void {
const type = getTypeOfNode(declaration);
const tags = collectTsPlusCompanionTags(declaration);
if (type.symbol) {
for (const companionTag of tags) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
+ getTsPlusSourceFileCache(companionTag).add(getSourceFileOfNode(declaration));
addToCompanionSymbolCache(type.symbol, companionTag);
}
}
@@ -46704,10 +46711,10 @@ namespace ts {
function cacheTsPlusStaticVariable(file: SourceFile, declaration: VariableDeclarationWithIdentifier) {
const staticTags = collectTsPlusStaticTags(declaration);
if (staticTags.length > 0) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
const symbol = getSymbolAtLocation(declaration.name);
if (symbol) {
for (const { target, name } of staticTags) {
+ getTsPlusSourceFileCache(target).add(getSourceFileOfNode(declaration));
if (!unresolvedStaticCache.get(target)) {
unresolvedStaticCache.set(target, new Map());
}
@@ -46727,7 +46734,7 @@ namespace ts {
function cacheTsPlusFluentVariable(file: SourceFile, declaration: VariableDeclarationWithIdentifier) {
const fluentTags = collectTsPlusFluentTags(declaration);
for (const tag of fluentTags) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
+ getTsPlusSourceFileCache(tag.target).add(getSourceFileOfNode(declaration));
if (!unresolvedFluentCache.has(tag.target)) {
unresolvedFluentCache.set(tag.target, new Map());
}
@@ -46757,6 +46764,7 @@ namespace ts {
}
function cacheTsPlusGetterVariable(file: SourceFile, declaration: VariableDeclarationWithIdentifier) {
for (const { target, name } of collectTsPlusGetterTags(declaration)) {
+ getTsPlusSourceFileCache(target).add(getSourceFileOfNode(declaration));
if (!getterCache.has(target)) {
getterCache.set(target, new Map());
}
@@ -46776,10 +46784,10 @@ namespace ts {
if(declaration.name && isIdentifier(declaration.name)) {
const operatorTags = collectTsPlusOperatorTags(declaration);
if (operatorTags.length > 0) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
const symbol = getSymbolAtLocation(declaration.name);
if (symbol) {
for (const tag of operatorTags) {
+ getTsPlusSourceFileCache(tag.target).add(getSourceFileOfNode(declaration));
if (!operatorCache.has(tag.target)) {
operatorCache.set(tag.target, new Map());
}
@@ -46804,7 +46812,7 @@ namespace ts {
const symbol = getSymbolAtLocation(declaration.name);
if (symbol) {
for (const tag of operatorTags) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
+ getTsPlusSourceFileCache(tag.target).add(getSourceFileOfNode(declaration));
if (!operatorCache.has(tag.target)) {
operatorCache.set(tag.target, new Map());
}
@@ -46825,7 +46833,7 @@ namespace ts {
function cacheTsPlusFluentFunction(file: SourceFile, declaration: FunctionDeclaration) {
const fluentTags = collectTsPlusFluentTags(declaration);
for (const tag of fluentTags) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
+ getTsPlusSourceFileCache(tag.target).add(getSourceFileOfNode(declaration));
if (!unresolvedFluentCache.has(tag.target)) {
unresolvedFluentCache.set(tag.target, new Map());
}
@@ -46857,8 +46865,8 @@ namespace ts {
if (declaration.name && isIdentifier(declaration.name)) {
const pipeableOperatorTags = collectTsPlusPipeableOperatorTags(declaration);
if (pipeableOperatorTags.length > 0) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
for (const { target, name, priority } of pipeableOperatorTags) {
+ getTsPlusSourceFileCache(target).add(getSourceFileOfNode(declaration));
if (!unresolvedPipeableOperatorCache.has(target)) {
unresolvedPipeableOperatorCache.set(target, new Map())
}
@@ -46909,8 +46917,8 @@ namespace ts {
(declaration.type && isFunctionTypeNode(declaration.type))) {
const pipeableOperatorTags = collectTsPlusPipeableOperatorTags(declaration);
if (pipeableOperatorTags.length > 0) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
for (const { target, name, priority } of pipeableOperatorTags) {
+ getTsPlusSourceFileCache(target).add(getSourceFileOfNode(declaration));
if (!unresolvedPipeableOperatorCache.has(target)) {
unresolvedPipeableOperatorCache.set(target, new Map())
}
@@ -46960,7 +46968,7 @@ namespace ts {
if (declaration.name && isIdentifier(declaration.name)) {
const pipeableTags = collectTsPlusPipeableTags(declaration);
for (const { target, name, priority } of pipeableTags) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
+ getTsPlusSourceFileCache(target).add(getSourceFileOfNode(declaration));
if (!unresolvedPipeableCache.has(target)) {
unresolvedPipeableCache.set(target, new Map());
}
@@ -47014,7 +47022,7 @@ namespace ts {
if((declaration.initializer && isFunctionLikeDeclaration(declaration.initializer)) ||
(declaration.type && isFunctionTypeNode(declaration.type))) {
for (const { target, name, priority } of collectTsPlusPipeableTags(declaration)) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
+ getTsPlusSourceFileCache(target).add(getSourceFileOfNode(declaration));
if (!unresolvedPipeableCache.has(target)) {
unresolvedPipeableCache.set(target, new Map());
}
@@ -47073,7 +47081,7 @@ namespace ts {
function cacheTsPlusGetterFunction(file: SourceFile, declaration: FunctionDeclaration) {
if(declaration.name && isIdentifier(declaration.name)) {
for (const { target, name } of collectTsPlusGetterTags(declaration)) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
+ getTsPlusSourceFileCache(target).add(getSourceFileOfNode(declaration));
if (!getterCache.has(target)) {
getterCache.set(target, new Map());
}
@@ -47090,7 +47098,7 @@ namespace ts {
function cacheTsPlusStaticFunction(file: SourceFile, declaration: FunctionDeclaration) {
if(declaration.name && isIdentifier(declaration.name)) {
for (const { target, name } of collectTsPlusStaticTags(declaration)) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
+ getTsPlusSourceFileCache(target).add(getSourceFileOfNode(declaration));
if (!staticCache.has(target)) {
staticCache.set(target, new Map());
}
@@ -47127,7 +47135,7 @@ namespace ts {
function cacheTsPlusUnifyFunction(declaration: FunctionDeclaration) {
if(declaration.name && isIdentifier(declaration.name)) {
for (const target of collectTsPlusUnifyTags(declaration)) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
+ getTsPlusSourceFileCache(target).add(getSourceFileOfNode(declaration));
identityCache.set(target, declaration);
}
}
@@ -47135,7 +47143,7 @@ namespace ts {
function cacheTsPlusIndexFunction(declaration: FunctionDeclaration) {
if(declaration.name && isIdentifier(declaration.name)) {
for (const target of collectTsPlusIndexTags(declaration)) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
+ getTsPlusSourceFileCache(target).add(getSourceFileOfNode(declaration));
indexCache.set(target, () => {
if (resolvedIndexCache.has(target)) {
return resolvedIndexCache.get(target);
@@ -47152,7 +47160,7 @@ namespace ts {
}
function cacheTsPlusIndexVariable(declaration: VariableDeclarationWithIdentifier) {
for (const target of collectTsPlusIndexTags(declaration)) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
+ getTsPlusSourceFileCache(target).add(getSourceFileOfNode(declaration));
indexCache.set(target, () => {
if (resolvedIndexCache.has(target)) {
return resolvedIndexCache.get(target);
@@ -47169,7 +47177,7 @@ namespace ts {
function cacheTsPlusPipeableIndexFunction(declaration: FunctionDeclaration) {
if(declaration.name && isIdentifier(declaration.name)) {
for (const target of collectTsPlusPipeableIndexTags(declaration)) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
+ getTsPlusSourceFileCache(target).add(getSourceFileOfNode(declaration));
indexCache.set(target, () => {
if (resolvedIndexCache.has(target)) {
return resolvedIndexCache.get(target);
@@ -47187,7 +47195,7 @@ namespace ts {
}
function cacheTsPlusPipeableIndexVariable(declaration: VariableDeclarationWithIdentifier) {
for (const target of collectTsPlusPipeableIndexTags(declaration)) {
- tsPlusFiles.add(getSourceFileOfNode(declaration));
+ getTsPlusSourceFileCache(target).add(getSourceFileOfNode(declaration));
indexCache.set(target, () => {
if (resolvedIndexCache.has(target)) {
return resolvedIndexCache.get(target);
@@ -47325,6 +47333,21 @@ namespace ts {
fillTsPlusLocalScope(file);
}
}
+ function postInitTsPlusTypeChecker() {
+ tsPlusDebug && console.time("initTsPlusTypeChecker build dependency tree")
+ typeSymbolCache.forEach((tags, symbol) => {
+ forEach(symbol.declarations, (declaration) => {
+ const source = getSourceFileOfNode(declaration);
+ const set = tsPlusFilesFinal.has(source) ? tsPlusFilesFinal.get(source)! : (tsPlusFilesFinal.set(source, new Set()), tsPlusFilesFinal.get(source)!);
+ forEach(tags, (tag) => {
+ tsPlusFiles.get(tag)?.forEach((dep) => {
+ set.add(dep);
+ })
+ })
+ })
+ })
+ tsPlusDebug && console.timeEnd("initTsPlusTypeChecker build dependency tree")
+ }
function initTsPlusTypeChecker() {
tsPlusDebug && console.time("initTsPlusTypeChecker caches")
fileMap.map = getFileMap(host.getCompilerOptions(), host);
@@ -47340,6 +47363,7 @@ namespace ts {
unresolvedStaticCache.clear();
identityCache.clear();
tsPlusFiles.clear();
+ tsPlusFilesFinal.clear();
getterCache.clear();
callCache.clear();
indexCache.clear();
@@ -47557,6 +47581,7 @@ namespace ts {
tsPlusDebug && console.time("initTsPlusTypeChecker implicits")
initTsPlusTypeCheckerImplicits();
tsPlusDebug && console.timeEnd("initTsPlusTypeChecker implicits")
+ postInitTsPlusTypeChecker();
}
// TSPLUS EXTENSION END
diff --git a/src/compiler/types.ts b/src/compiler/types.ts
index b521b7b8e09..f08f3c7d270 100644
--- a/src/compiler/types.ts
+++ b/src/compiler/types.ts
@@ -4984,7 +4984,8 @@ namespace ts {
getResolvedOperator(node: BinaryExpression): Signature | undefined
getNodeLinks(node: Node): NodeLinks
// TSPLUS START
- getTsPlusFiles(): Set
+ getTsPlusFiles(): ESMap>
+ getTsPlusGlobalImports(): ESMap
collectTsPlusMacroTags(statement: Declaration): readonly string[]
getTsPlusGlobals(): Symbol[];
getTsPlusGlobal(name: string): TsPlusGlobalImport | undefined;