Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31078 from andrewbranch/bug/30752
Fix symbol merging of augmentations to pattern ambient modules
- Loading branch information
Showing
16 changed files
with
386 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
tests/baselines/reference/ambientDeclarationsPatterns_merging1.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
tests/cases/conformance/ambient/testB.ts(1,22): error TS2305: Module '"*.foo"' has no exported member 'onlyInA'. | ||
|
||
|
||
==== tests/cases/conformance/ambient/types.ts (0 errors) ==== | ||
declare module "*.foo" { | ||
let everywhere: string; | ||
} | ||
|
||
|
||
==== tests/cases/conformance/ambient/testA.ts (0 errors) ==== | ||
import { everywhere, onlyInA } from "a.foo"; | ||
declare module "a.foo" { | ||
let onlyInA: number; | ||
} | ||
|
||
==== tests/cases/conformance/ambient/testB.ts (1 errors) ==== | ||
import { everywhere, onlyInA } from "b.foo"; // Error | ||
~~~~~~~ | ||
!!! error TS2305: Module '"*.foo"' has no exported member 'onlyInA'. | ||
|
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/ambientDeclarationsPatterns_merging1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//// [tests/cases/conformance/ambient/ambientDeclarationsPatterns_merging1.ts] //// | ||
|
||
//// [types.ts] | ||
declare module "*.foo" { | ||
let everywhere: string; | ||
} | ||
|
||
|
||
//// [testA.ts] | ||
import { everywhere, onlyInA } from "a.foo"; | ||
declare module "a.foo" { | ||
let onlyInA: number; | ||
} | ||
|
||
//// [testB.ts] | ||
import { everywhere, onlyInA } from "b.foo"; // Error | ||
|
||
|
||
//// [types.js] | ||
//// [testA.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
//// [testB.js] | ||
"use strict"; | ||
exports.__esModule = true; |
26 changes: 26 additions & 0 deletions
26
tests/baselines/reference/ambientDeclarationsPatterns_merging1.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
=== tests/cases/conformance/ambient/types.ts === | ||
declare module "*.foo" { | ||
>"*.foo" : Symbol("*.foo", Decl(types.ts, 0, 0)) | ||
|
||
let everywhere: string; | ||
>everywhere : Symbol(everywhere, Decl(types.ts, 1, 5)) | ||
} | ||
|
||
|
||
=== tests/cases/conformance/ambient/testA.ts === | ||
import { everywhere, onlyInA } from "a.foo"; | ||
>everywhere : Symbol(everywhere, Decl(testA.ts, 0, 8)) | ||
>onlyInA : Symbol(onlyInA, Decl(testA.ts, 0, 20)) | ||
|
||
declare module "a.foo" { | ||
>"a.foo" : Symbol("a.foo", Decl(testA.ts, 0, 44), Decl(types.ts, 0, 0)) | ||
|
||
let onlyInA: number; | ||
>onlyInA : Symbol(onlyInA, Decl(testA.ts, 2, 5)) | ||
} | ||
|
||
=== tests/cases/conformance/ambient/testB.ts === | ||
import { everywhere, onlyInA } from "b.foo"; // Error | ||
>everywhere : Symbol(everywhere, Decl(testB.ts, 0, 8)) | ||
>onlyInA : Symbol(onlyInA, Decl(testB.ts, 0, 20)) | ||
|
26 changes: 26 additions & 0 deletions
26
tests/baselines/reference/ambientDeclarationsPatterns_merging1.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
=== tests/cases/conformance/ambient/types.ts === | ||
declare module "*.foo" { | ||
>"*.foo" : typeof import("*.foo") | ||
|
||
let everywhere: string; | ||
>everywhere : string | ||
} | ||
|
||
|
||
=== tests/cases/conformance/ambient/testA.ts === | ||
import { everywhere, onlyInA } from "a.foo"; | ||
>everywhere : string | ||
>onlyInA : number | ||
|
||
declare module "a.foo" { | ||
>"a.foo" : typeof import("a.foo") | ||
|
||
let onlyInA: number; | ||
>onlyInA : number | ||
} | ||
|
||
=== tests/cases/conformance/ambient/testB.ts === | ||
import { everywhere, onlyInA } from "b.foo"; // Error | ||
>everywhere : string | ||
>onlyInA : any | ||
|
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/ambientDeclarationsPatterns_merging2.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
tests/cases/conformance/ambient/testB.ts(1,22): error TS2305: Module '"*.foo"' has no exported member 'onlyInA'. | ||
tests/cases/conformance/ambient/testB.ts(1,31): error TS2305: Module '"*.foo"' has no exported member 'alsoOnlyInA'. | ||
|
||
|
||
==== tests/cases/conformance/ambient/types.ts (0 errors) ==== | ||
declare module "*.foo" { | ||
let everywhere: string; | ||
} | ||
|
||
|
||
==== tests/cases/conformance/ambient/testA.ts (0 errors) ==== | ||
import { everywhere, onlyInA, alsoOnlyInA } from "a.foo"; | ||
declare module "a.foo" { | ||
let onlyInA: number; | ||
} | ||
|
||
==== tests/cases/conformance/ambient/testB.ts (2 errors) ==== | ||
import { everywhere, onlyInA, alsoOnlyInA } from "b.foo"; // Error | ||
~~~~~~~ | ||
!!! error TS2305: Module '"*.foo"' has no exported member 'onlyInA'. | ||
~~~~~~~~~~~ | ||
!!! error TS2305: Module '"*.foo"' has no exported member 'alsoOnlyInA'. | ||
declare module "a.foo" { | ||
let alsoOnlyInA: number; | ||
} |
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/ambientDeclarationsPatterns_merging2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//// [tests/cases/conformance/ambient/ambientDeclarationsPatterns_merging2.ts] //// | ||
|
||
//// [types.ts] | ||
declare module "*.foo" { | ||
let everywhere: string; | ||
} | ||
|
||
|
||
//// [testA.ts] | ||
import { everywhere, onlyInA, alsoOnlyInA } from "a.foo"; | ||
declare module "a.foo" { | ||
let onlyInA: number; | ||
} | ||
|
||
//// [testB.ts] | ||
import { everywhere, onlyInA, alsoOnlyInA } from "b.foo"; // Error | ||
declare module "a.foo" { | ||
let alsoOnlyInA: number; | ||
} | ||
|
||
//// [types.js] | ||
//// [testA.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
//// [testB.js] | ||
"use strict"; | ||
exports.__esModule = true; |
34 changes: 34 additions & 0 deletions
34
tests/baselines/reference/ambientDeclarationsPatterns_merging2.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
=== tests/cases/conformance/ambient/types.ts === | ||
declare module "*.foo" { | ||
>"*.foo" : Symbol("*.foo", Decl(types.ts, 0, 0)) | ||
|
||
let everywhere: string; | ||
>everywhere : Symbol(everywhere, Decl(types.ts, 1, 5)) | ||
} | ||
|
||
|
||
=== tests/cases/conformance/ambient/testA.ts === | ||
import { everywhere, onlyInA, alsoOnlyInA } from "a.foo"; | ||
>everywhere : Symbol(everywhere, Decl(testA.ts, 0, 8)) | ||
>onlyInA : Symbol(onlyInA, Decl(testA.ts, 0, 20)) | ||
>alsoOnlyInA : Symbol(alsoOnlyInA, Decl(testA.ts, 0, 29)) | ||
|
||
declare module "a.foo" { | ||
>"a.foo" : Symbol("a.foo", Decl(testA.ts, 0, 57), Decl(types.ts, 0, 0), Decl(testB.ts, 0, 57)) | ||
|
||
let onlyInA: number; | ||
>onlyInA : Symbol(onlyInA, Decl(testA.ts, 2, 5)) | ||
} | ||
|
||
=== tests/cases/conformance/ambient/testB.ts === | ||
import { everywhere, onlyInA, alsoOnlyInA } from "b.foo"; // Error | ||
>everywhere : Symbol(everywhere, Decl(testB.ts, 0, 8)) | ||
>onlyInA : Symbol(onlyInA, Decl(testB.ts, 0, 20)) | ||
>alsoOnlyInA : Symbol(alsoOnlyInA, Decl(testB.ts, 0, 29)) | ||
|
||
declare module "a.foo" { | ||
>"a.foo" : Symbol("a.foo", Decl(testA.ts, 0, 57), Decl(types.ts, 0, 0), Decl(testB.ts, 0, 57)) | ||
|
||
let alsoOnlyInA: number; | ||
>alsoOnlyInA : Symbol(alsoOnlyInA, Decl(testB.ts, 2, 5)) | ||
} |
34 changes: 34 additions & 0 deletions
34
tests/baselines/reference/ambientDeclarationsPatterns_merging2.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
=== tests/cases/conformance/ambient/types.ts === | ||
declare module "*.foo" { | ||
>"*.foo" : typeof import("*.foo") | ||
|
||
let everywhere: string; | ||
>everywhere : string | ||
} | ||
|
||
|
||
=== tests/cases/conformance/ambient/testA.ts === | ||
import { everywhere, onlyInA, alsoOnlyInA } from "a.foo"; | ||
>everywhere : string | ||
>onlyInA : number | ||
>alsoOnlyInA : number | ||
|
||
declare module "a.foo" { | ||
>"a.foo" : typeof import("a.foo") | ||
|
||
let onlyInA: number; | ||
>onlyInA : number | ||
} | ||
|
||
=== tests/cases/conformance/ambient/testB.ts === | ||
import { everywhere, onlyInA, alsoOnlyInA } from "b.foo"; // Error | ||
>everywhere : string | ||
>onlyInA : any | ||
>alsoOnlyInA : any | ||
|
||
declare module "a.foo" { | ||
>"a.foo" : typeof import("a.foo") | ||
|
||
let alsoOnlyInA: number; | ||
>alsoOnlyInA : number | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/ambientDeclarationsPatterns_merging3.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
tests/cases/conformance/ambient/test.ts(6,6): error TS2339: Property 'a' does not exist on type 'OhNo'. | ||
|
||
|
||
==== tests/cases/conformance/ambient/types.ts (0 errors) ==== | ||
declare module "*.foo" { | ||
export interface OhNo { star: string } | ||
} | ||
|
||
==== tests/cases/conformance/ambient/test.ts (1 errors) ==== | ||
declare module "a.foo" { | ||
export interface OhNo { a: string } | ||
} | ||
import { OhNo } from "b.foo" | ||
declare let ohno: OhNo; | ||
ohno.a // oh no | ||
~ | ||
!!! error TS2339: Property 'a' does not exist on type 'OhNo'. | ||
|
21 changes: 21 additions & 0 deletions
21
tests/baselines/reference/ambientDeclarationsPatterns_merging3.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//// [tests/cases/conformance/ambient/ambientDeclarationsPatterns_merging3.ts] //// | ||
|
||
//// [types.ts] | ||
declare module "*.foo" { | ||
export interface OhNo { star: string } | ||
} | ||
|
||
//// [test.ts] | ||
declare module "a.foo" { | ||
export interface OhNo { a: string } | ||
} | ||
import { OhNo } from "b.foo" | ||
declare let ohno: OhNo; | ||
ohno.a // oh no | ||
|
||
|
||
//// [types.js] | ||
//// [test.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
ohno.a; // oh no |
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/ambientDeclarationsPatterns_merging3.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
=== tests/cases/conformance/ambient/types.ts === | ||
declare module "*.foo" { | ||
>"*.foo" : Symbol("*.foo", Decl(types.ts, 0, 0)) | ||
|
||
export interface OhNo { star: string } | ||
>OhNo : Symbol(OhNo, Decl(types.ts, 0, 24)) | ||
>star : Symbol(OhNo.star, Decl(types.ts, 1, 25)) | ||
} | ||
|
||
=== tests/cases/conformance/ambient/test.ts === | ||
declare module "a.foo" { | ||
>"a.foo" : Symbol("a.foo", Decl(test.ts, 0, 0), Decl(types.ts, 0, 0)) | ||
|
||
export interface OhNo { a: string } | ||
>OhNo : Symbol(OhNo, Decl(test.ts, 0, 24), Decl(types.ts, 0, 24)) | ||
>a : Symbol(OhNo.a, Decl(test.ts, 1, 25)) | ||
} | ||
import { OhNo } from "b.foo" | ||
>OhNo : Symbol(OhNo, Decl(test.ts, 3, 8)) | ||
|
||
declare let ohno: OhNo; | ||
>ohno : Symbol(ohno, Decl(test.ts, 4, 11)) | ||
>OhNo : Symbol(OhNo, Decl(test.ts, 3, 8)) | ||
|
||
ohno.a // oh no | ||
>ohno : Symbol(ohno, Decl(test.ts, 4, 11)) | ||
|
Oops, something went wrong.