Skip to content

Commit 37ec065

Browse files
committed
Add path back-reference tests
1 parent dc5cd96 commit 37ec065

File tree

32 files changed

+602
-155
lines changed

32 files changed

+602
-155
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22233,7 +22233,7 @@ namespace ts {
2223322233
for (const decl of indexSymbol.declarations) {
2223422234
const declaration = <SignatureDeclaration>decl;
2223522235
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
22236-
switch (declaration.parameters[0].type.kind) {
22236+
switch (declaration.parameters[0].type!.kind) {
2223722237
case SyntaxKind.StringKeyword:
2223822238
if (!seenStringIndexer) {
2223922239
seenStringIndexer = true;

tests/baselines/reference/typesVersions.ambientModules.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"version": "1.0.0",
77
"types": "index",
88
"typesVersions": {
9-
"3.0": { "*" : ["ts3.0/*"] }
9+
"3.1": { "*" : ["ts3.1/*"] }
1010
}
1111
}
1212

@@ -20,18 +20,18 @@ declare module "ext/other" {
2020

2121
//// [index.d.ts]
2222
declare module "ext" {
23-
export const a = "ts3.0 a";
23+
export const a = "ts3.1 a";
2424
}
2525
declare module "ext/other" {
26-
export const b = "ts3.0 b";
26+
export const b = "ts3.1 b";
2727
}
2828

2929
//// [main.ts]
3030
import { a } from "ext";
3131
import { b } from "ext/other";
3232

33-
const aa: "ts3.0 a" = a;
34-
const bb: "ts3.0 b" = b;
33+
const aa: "ts3.1 a" = a;
34+
const bb: "ts3.1 b" = b;
3535

3636

3737
//// [main.js]

tests/baselines/reference/typesVersions.ambientModules.symbols

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ import { a } from "ext";
55
import { b } from "ext/other";
66
>b : Symbol(b, Decl(main.ts, 1, 8))
77

8-
const aa: "ts3.0 a" = a;
8+
const aa: "ts3.1 a" = a;
99
>aa : Symbol(aa, Decl(main.ts, 3, 5))
1010
>a : Symbol(a, Decl(main.ts, 0, 8))
1111

12-
const bb: "ts3.0 b" = b;
12+
const bb: "ts3.1 b" = b;
1313
>bb : Symbol(bb, Decl(main.ts, 4, 5))
1414
>b : Symbol(b, Decl(main.ts, 1, 8))
1515

16-
=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts ===
16+
=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts ===
1717
declare module "ext" {
1818
>"ext" : Symbol("ext", Decl(index.d.ts, 0, 0))
1919

20-
export const a = "ts3.0 a";
20+
export const a = "ts3.1 a";
2121
>a : Symbol(a, Decl(index.d.ts, 1, 16))
2222
}
2323
declare module "ext/other" {
2424
>"ext/other" : Symbol("ext/other", Decl(index.d.ts, 2, 1))
2525

26-
export const b = "ts3.0 b";
26+
export const b = "ts3.1 b";
2727
>b : Symbol(b, Decl(index.d.ts, 4, 16))
2828
}
2929

tests/baselines/reference/typesVersions.ambientModules.trace.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@
1111
"File 'tests/cases/conformance/moduleResolution/node_modules/ext.d.ts' does not exist.",
1212
"'package.json' does not have a 'typings' field.",
1313
"'package.json' has 'types' field 'index' that references 'tests/cases/conformance/moduleResolution/node_modules/ext/index'.",
14-
"'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'index'.",
14+
"'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'index'.",
1515
"Module name 'index', matched pattern '*'.",
16-
"Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/index'.",
17-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index' does not exist.",
18-
"Loading module as file / folder, candidate module location 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index', target file type 'TypeScript'.",
19-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.ts' does not exist.",
20-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.tsx' does not exist.",
21-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts' exist - use it as a name resolution result.",
22-
"Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts'.",
23-
"======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts'. ========",
16+
"Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.",
17+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index' does not exist.",
18+
"Loading module as file / folder, candidate module location 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index', target file type 'TypeScript'.",
19+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.ts' does not exist.",
20+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.tsx' does not exist.",
21+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.",
22+
"Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'.",
23+
"======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'. ========",
2424
"======== Resolving module 'ext/other' from 'tests/cases/conformance/moduleResolution/main.ts'. ========",
2525
"Module resolution kind is not specified, using 'NodeJs'.",
2626
"Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.",
2727
"'package.json' has a 'typesVersions' field with version-specific path mappings.",
2828
"Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'. Package ID is 'ext/other/[email protected]'.",
29-
"'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'other'.",
29+
"'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'other'.",
3030
"Module name 'other', matched pattern '*'.",
31-
"Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/other'.",
32-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.ts' does not exist.",
33-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.tsx' does not exist.",
34-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts' does not exist.",
31+
"Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.",
32+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.ts' does not exist.",
33+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.tsx' does not exist.",
34+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts' does not exist.",
3535
"Directory 'tests/cases/conformance/moduleResolution/node_modules/@types' does not exist, skipping all lookups in it.",
3636
"Directory 'tests/cases/conformance/node_modules' does not exist, skipping all lookups in it.",
3737
"Directory 'tests/cases/node_modules' does not exist, skipping all lookups in it.",
@@ -41,11 +41,11 @@
4141
"Loading module 'ext/other' from 'node_modules' folder, target file type 'JavaScript'.",
4242
"'package.json' has a 'typesVersions' field with version-specific path mappings.",
4343
"Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'. Package ID is 'ext/other/[email protected]'.",
44-
"'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'other'.",
44+
"'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'other'.",
4545
"Module name 'other', matched pattern '*'.",
46-
"Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/other'.",
47-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.js' does not exist.",
48-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.jsx' does not exist.",
46+
"Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.",
47+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.js' does not exist.",
48+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.jsx' does not exist.",
4949
"Directory 'tests/cases/conformance/node_modules' does not exist, skipping all lookups in it.",
5050
"Directory 'tests/cases/node_modules' does not exist, skipping all lookups in it.",
5151
"Directory 'tests/node_modules' does not exist, skipping all lookups in it.",
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
=== tests/cases/conformance/moduleResolution/main.ts ===
22
import { a } from "ext";
3-
>a : "ts3.0 a"
3+
>a : "ts3.1 a"
44

55
import { b } from "ext/other";
6-
>b : "ts3.0 b"
6+
>b : "ts3.1 b"
77

8-
const aa: "ts3.0 a" = a;
9-
>aa : "ts3.0 a"
10-
>a : "ts3.0 a"
8+
const aa: "ts3.1 a" = a;
9+
>aa : "ts3.1 a"
10+
>a : "ts3.1 a"
1111

12-
const bb: "ts3.0 b" = b;
13-
>bb : "ts3.0 b"
14-
>b : "ts3.0 b"
12+
const bb: "ts3.1 b" = b;
13+
>bb : "ts3.1 b"
14+
>b : "ts3.1 b"
1515

16-
=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts ===
16+
=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts ===
1717
declare module "ext" {
1818
>"ext" : typeof import("ext")
1919

20-
export const a = "ts3.0 a";
21-
>a : "ts3.0 a"
22-
>"ts3.0 a" : "ts3.0 a"
20+
export const a = "ts3.1 a";
21+
>a : "ts3.1 a"
22+
>"ts3.1 a" : "ts3.1 a"
2323
}
2424
declare module "ext/other" {
2525
>"ext/other" : typeof import("ext/other")
2626

27-
export const b = "ts3.0 b";
28-
>b : "ts3.0 b"
29-
>"ts3.0 b" : "ts3.0 b"
27+
export const b = "ts3.1 b";
28+
>b : "ts3.1 b"
29+
>"ts3.1 b" : "ts3.1 b"
3030
}
3131

tests/baselines/reference/typesVersions.multiFile.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"version": "1.0.0",
77
"types": "index",
88
"typesVersions": {
9-
"3.0": { "*" : ["ts3.0/*"] }
9+
"3.1": { "*" : ["ts3.1/*"] }
1010
}
1111
}
1212

@@ -17,17 +17,17 @@ export const a = "default a";
1717
export const b = "default b";
1818

1919
//// [index.d.ts]
20-
export const a = "ts3.0 a";
20+
export const a = "ts3.1 a";
2121

2222
//// [other.d.ts]
23-
export const b = "ts3.0 b";
23+
export const b = "ts3.1 b";
2424

2525
//// [main.ts]
2626
import { a } from "ext";
2727
import { b } from "ext/other";
2828

29-
const aa: "ts3.0 a" = a;
30-
const bb: "ts3.0 b" = b;
29+
const aa: "ts3.1 a" = a;
30+
const bb: "ts3.1 b" = b;
3131

3232

3333
//// [main.js]

tests/baselines/reference/typesVersions.multiFile.symbols

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ export const a = "default a";
66
export const b = "default b";
77
>b : Symbol(b, Decl(other.d.ts, 0, 12))
88

9-
=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts ===
10-
export const a = "ts3.0 a";
9+
=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts ===
10+
export const a = "ts3.1 a";
1111
>a : Symbol(a, Decl(index.d.ts, 0, 12))
1212

13-
=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts ===
14-
export const b = "ts3.0 b";
13+
=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts ===
14+
export const b = "ts3.1 b";
1515
>b : Symbol(b, Decl(other.d.ts, 0, 12))
1616

1717
=== tests/cases/conformance/moduleResolution/main.ts ===
@@ -21,11 +21,11 @@ import { a } from "ext";
2121
import { b } from "ext/other";
2222
>b : Symbol(b, Decl(main.ts, 1, 8))
2323

24-
const aa: "ts3.0 a" = a;
24+
const aa: "ts3.1 a" = a;
2525
>aa : Symbol(aa, Decl(main.ts, 3, 5))
2626
>a : Symbol(a, Decl(main.ts, 0, 8))
2727

28-
const bb: "ts3.0 b" = b;
28+
const bb: "ts3.1 b" = b;
2929
>bb : Symbol(bb, Decl(main.ts, 4, 5))
3030
>b : Symbol(b, Decl(main.ts, 1, 8))
3131

tests/baselines/reference/typesVersions.multiFile.trace.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@
1111
"File 'tests/cases/conformance/moduleResolution/node_modules/ext.d.ts' does not exist.",
1212
"'package.json' does not have a 'typings' field.",
1313
"'package.json' has 'types' field 'index' that references 'tests/cases/conformance/moduleResolution/node_modules/ext/index'.",
14-
"'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'index'.",
14+
"'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'index'.",
1515
"Module name 'index', matched pattern '*'.",
16-
"Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/index'.",
17-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index' does not exist.",
18-
"Loading module as file / folder, candidate module location 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index', target file type 'TypeScript'.",
19-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.ts' does not exist.",
20-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.tsx' does not exist.",
21-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts' exist - use it as a name resolution result.",
22-
"Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts'.",
23-
"======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts'. ========",
16+
"Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.",
17+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index' does not exist.",
18+
"Loading module as file / folder, candidate module location 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index', target file type 'TypeScript'.",
19+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.ts' does not exist.",
20+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.tsx' does not exist.",
21+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.",
22+
"Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'.",
23+
"======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'. ========",
2424
"======== Resolving module 'ext/other' from 'tests/cases/conformance/moduleResolution/main.ts'. ========",
2525
"Module resolution kind is not specified, using 'NodeJs'.",
2626
"Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.",
2727
"'package.json' has a 'typesVersions' field with version-specific path mappings.",
2828
"Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'. Package ID is 'ext/other/[email protected]'.",
29-
"'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'other'.",
29+
"'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'other'.",
3030
"Module name 'other', matched pattern '*'.",
31-
"Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/other'.",
32-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.ts' does not exist.",
33-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.tsx' does not exist.",
34-
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts' exist - use it as a name resolution result.",
35-
"Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts'.",
36-
"======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts'. ========"
31+
"Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.",
32+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.ts' does not exist.",
33+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.tsx' does not exist.",
34+
"File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts' exist - use it as a name resolution result.",
35+
"Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts'.",
36+
"======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts'. ========"
3737
]

tests/baselines/reference/typesVersions.multiFile.types

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@ export const b = "default b";
88
>b : "default b"
99
>"default b" : "default b"
1010

11-
=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts ===
12-
export const a = "ts3.0 a";
13-
>a : "ts3.0 a"
14-
>"ts3.0 a" : "ts3.0 a"
11+
=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts ===
12+
export const a = "ts3.1 a";
13+
>a : "ts3.1 a"
14+
>"ts3.1 a" : "ts3.1 a"
1515

16-
=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts ===
17-
export const b = "ts3.0 b";
18-
>b : "ts3.0 b"
19-
>"ts3.0 b" : "ts3.0 b"
16+
=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts ===
17+
export const b = "ts3.1 b";
18+
>b : "ts3.1 b"
19+
>"ts3.1 b" : "ts3.1 b"
2020

2121
=== tests/cases/conformance/moduleResolution/main.ts ===
2222
import { a } from "ext";
23-
>a : "ts3.0 a"
23+
>a : "ts3.1 a"
2424

2525
import { b } from "ext/other";
26-
>b : "ts3.0 b"
26+
>b : "ts3.1 b"
2727

28-
const aa: "ts3.0 a" = a;
29-
>aa : "ts3.0 a"
30-
>a : "ts3.0 a"
28+
const aa: "ts3.1 a" = a;
29+
>aa : "ts3.1 a"
30+
>a : "ts3.1 a"
3131

32-
const bb: "ts3.0 b" = b;
33-
>bb : "ts3.0 b"
34-
>b : "ts3.0 b"
32+
const bb: "ts3.1 b" = b;
33+
>bb : "ts3.1 b"
34+
>b : "ts3.1 b"
3535

tests/baselines/reference/typesVersionsDeclarationEmit.ambient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"version": "1.0.0",
77
"types": "index",
88
"typesVersions": {
9-
"3.0": { "*" : ["ts3.0/*"] }
9+
"3.1": { "*" : ["ts3.1/*"] }
1010
}
1111
}
1212

0 commit comments

Comments
 (0)