Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions internal/compiler/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -1224,29 +1224,29 @@ func (p *Program) getDiagnosticsHelper(ctx context.Context, sourceFile *ast.Sour
}

func (p *Program) addProgramDiagnostics() {
for _, m := range p.missingFiles {
reason := m.reason
var location core.TextRange
var parent *ast.SourceFile
var ref *ast.FileReference

if data, ok := reason.data.(*referencedFileData); ok {
parent = p.filesByPath[data.file]
if parent != nil && data.index < len(parent.ReferencedFiles) {
ref = parent.ReferencedFiles[data.index]
location = ref.TextRange
for _, missingFile := range p.missingFiles {
missingFileReason := missingFile.reason
refData, ok := missingFileReason.data.(*referencedFileData)
if !ok {
continue
}

parentFile := p.filesByPath[refData.file]
if parentFile == nil {
continue
}

for _, ref := range parentFile.ReferencedFiles {
if tspath.GetNormalizedAbsolutePath(tspath.GetDirectoryPath(parentFile.FileName()), ref.FileName) == missingFile.path {
diagnostic := ast.NewDiagnostic(
parentFile,
ref.TextRange,
diagnostics.File_0_not_found,
missingFile.path,
)
p.programDiagnostics = append(p.programDiagnostics, diagnostic)
}

}

diag := ast.NewDiagnostic(
parent,
location,
diagnostics.File_0_not_found,
m.path,
)

p.programDiagnostics = append(p.programDiagnostics, diag)
}
}

Expand Down Expand Up @@ -1582,7 +1582,7 @@ func (p *Program) GetIncludeReasons() map[tspath.Path][]*FileIncludeReason {
// Testing only
func (p *Program) IsMissingPath(path tspath.Path) bool {
return slices.ContainsFunc(p.missingFiles, func(missingPath missingFile) bool {
return p.toPath(missingPath.path) == path
return missingPath.path == string(path)
})
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- old.declarationEmitInvalidReference2.errors.txt
+++ new.declarationEmitInvalidReference2.errors.txt
@@= skipped -0, +0 lines =@@
-declarationEmitInvalidReference2.ts(1,22): error TS6053: File 'invalid.ts' not found.
-
-
-==== declarationEmitInvalidReference2.ts (1 errors) ====
- /// <reference path="invalid.ts" />
- ~~~~~~~~~~
-!!! error TS6053: File 'invalid.ts' not found.
- var x = 0;
+<no content>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
+++ new.declarationEmitInvalidReferenceAllowJs.errors.txt
@@= skipped -0, +0 lines =@@
-declarationEmitInvalidReferenceAllowJs.ts(1,22): error TS6231: Could not resolve the path 'invalid' with the extensions: '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'.
+declarationEmitInvalidReferenceAllowJs.ts(1,22): error TS6053: File 'invalid' not found.


==== declarationEmitInvalidReferenceAllowJs.ts (1 errors) ====
/// <reference path="invalid" />
~~~~~~~
-
-
-==== declarationEmitInvalidReferenceAllowJs.ts (1 errors) ====
- /// <reference path="invalid" />
- ~~~~~~~
-!!! error TS6231: Could not resolve the path 'invalid' with the extensions: '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'.
+!!! error TS6053: File 'invalid' not found.
var x = 0;
- var x = 0;
-
+<no content>
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
file2.ts:1:22 - error TS6053: File 'file1' not found.

1 /// <reference path="./file1" />
   ~~~~~~~

file2.ts:3:16 - error TS2664: Invalid module name in augmentation, module 'someMod' cannot be found.

3 declare module "someMod" {
   ~~~~~~~~~


==== file2.ts (2 errors) ====
==== file2.ts (1 errors) ====
/// <reference path="./file1" />
~~~~~~~
!!! error TS6053: File 'file1' not found.

declare module "someMod" {
~~~~~~~~~
Expand All @@ -33,5 +26,5 @@
duplicate3: () => string;
}
}
Found 2 errors in the same file, starting at: file2.ts:1
Found 1 error in file2.ts:3

Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,14 @@
-
-
-==== file2.ts (3 errors) ====
+file2.ts:1:22 - error TS6053: File 'file1' not found.
+
+1 /// <reference path="./file1" />
+   ~~~~~~~
+
+file2.ts:3:16 - error TS2664: Invalid module name in augmentation, module 'someMod' cannot be found.
+
+3 declare module "someMod" {
+   ~~~~~~~~~
+
+
+==== file2.ts (2 errors) ====
+==== file2.ts (1 errors) ====
/// <reference path="./file1" />
+ ~~~~~~~
+!!! error TS6053: File 'file1' not found.

declare module "someMod" {
+ ~~~~~~~~~
Expand Down Expand Up @@ -113,7 +106,7 @@
}
}
-Found 6 errors in 2 files.
+Found 2 errors in the same file, starting at: file2.ts:1
+Found 1 error in file2.ts:3

-Errors Files
- 3 file1.ts:3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
file2.ts:1:22 - error TS6053: File 'file1' not found.

1 /// <reference path="./file1" />
   ~~~~~~~

file2.ts:3:16 - error TS2664: Invalid module name in augmentation, module 'someMod' cannot be found.

3 declare module "someMod" {
   ~~~~~~~~~


==== file2.ts (2 errors) ====
==== file2.ts (1 errors) ====
/// <reference path="./file1" />
~~~~~~~
!!! error TS6053: File 'file1' not found.

declare module "someMod" {
~~~~~~~~~
Expand Down Expand Up @@ -45,5 +38,5 @@
duplicate9: () => string;
}
}
Found 2 errors in the same file, starting at: file2.ts:1
Found 1 error in file2.ts:3

Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
-   ~~~~~~~
- Conflicts are in this file.
-file2.ts:3:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: duplicate1, duplicate2, duplicate3, duplicate4, duplicate5, duplicate6, duplicate7, duplicate8, duplicate9
+file2.ts:1:22 - error TS6053: File 'file1' not found.
+
+1 /// <reference path="./file1" />
+   ~~~~~~~
+
+file2.ts:3:16 - error TS2664: Invalid module name in augmentation, module 'someMod' cannot be found.

3 declare module "someMod" {
Expand All @@ -25,16 +20,11 @@
- 1 declare module "someMod" {
-   ~~~~~~~
- Conflicts are in this file.
-
-
-==== file2.ts (1 errors) ====
+   ~~~~~~~~~
+
+
+==== file2.ts (2 errors) ====


==== file2.ts (1 errors) ====
/// <reference path="./file1" />
+ ~~~~~~~
+!!! error TS6053: File 'file1' not found.

declare module "someMod" {
- ~~~~~~~
Expand All @@ -45,7 +35,7 @@
export interface TopLevel {
duplicate1(): number;
duplicate2(): number;
@@= skipped -38, +30 lines =@@
@@= skipped -38, +23 lines =@@
}
export {};

Expand All @@ -63,7 +53,7 @@
}
}
-Found 2 errors in 2 files.
+Found 2 errors in the same file, starting at: file2.ts:1
+Found 1 error in file2.ts:3

-Errors Files
- 1 file1.ts:1
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- old.invalidTripleSlashReference.errors.txt
+++ new.invalidTripleSlashReference.errors.txt
@@= skipped -0, +0 lines =@@
-invalidTripleSlashReference.ts(1,22): error TS6053: File 'filedoesnotexist.ts' not found.
-invalidTripleSlashReference.ts(2,22): error TS6053: File 'otherdoesnotexist.d.ts' not found.
-
-
-==== invalidTripleSlashReference.ts (2 errors) ====
- /// <reference path='filedoesnotexist.ts'/>
- ~~~~~~~~~~~~~~~~~~~
-!!! error TS6053: File 'filedoesnotexist.ts' not found.
- /// <reference path='otherdoesnotexist.d.ts'/>
- ~~~~~~~~~~~~~~~~~~~~~~
-!!! error TS6053: File 'otherdoesnotexist.d.ts' not found.
-
- // this test doesn't actually give the errors you want due to the way the compiler reports errors
- var x = 1;
+<no content>
Loading