-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Add diagnostic context for expando property declarations #29905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
14 changes: 14 additions & 0 deletions
14
tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.errors.txt
This file contains hidden or 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,14 @@ | ||
tests/cases/compiler/b.ts(4,1): error TS4032: Property 'val' of exported interface has or is using name 'I' from private module '"tests/cases/compiler/a"'. | ||
|
||
|
||
==== tests/cases/compiler/a.ts (0 errors) ==== | ||
interface I {} | ||
export function f(): I { return null as I; } | ||
==== tests/cases/compiler/b.ts (1 errors) ==== | ||
import {f} from "./a"; | ||
|
||
export function q() {} | ||
q.val = f(); | ||
~~~~~ | ||
!!! error TS4032: Property 'val' of exported interface has or is using name 'I' from private module '"tests/cases/compiler/a"'. | ||
|
31 changes: 31 additions & 0 deletions
31
tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.js
This file contains hidden or 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,31 @@ | ||
//// [tests/cases/compiler/declarationEmitExpandoPropertyPrivateName.ts] //// | ||
|
||
//// [a.ts] | ||
interface I {} | ||
export function f(): I { return null as I; } | ||
//// [b.ts] | ||
import {f} from "./a"; | ||
|
||
export function q() {} | ||
q.val = f(); | ||
|
||
|
||
//// [a.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
function f() { return null; } | ||
exports.f = f; | ||
//// [b.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var a_1 = require("./a"); | ||
function q() { } | ||
exports.q = q; | ||
q.val = a_1.f(); | ||
|
||
|
||
//// [a.d.ts] | ||
interface I { | ||
} | ||
export declare function f(): I; | ||
export {}; |
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.symbols
This file contains hidden or 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,22 @@ | ||
=== tests/cases/compiler/a.ts === | ||
interface I {} | ||
>I : Symbol(I, Decl(a.ts, 0, 0)) | ||
|
||
export function f(): I { return null as I; } | ||
>f : Symbol(f, Decl(a.ts, 0, 14)) | ||
>I : Symbol(I, Decl(a.ts, 0, 0)) | ||
>I : Symbol(I, Decl(a.ts, 0, 0)) | ||
|
||
=== tests/cases/compiler/b.ts === | ||
import {f} from "./a"; | ||
>f : Symbol(f, Decl(b.ts, 0, 8)) | ||
|
||
export function q() {} | ||
>q : Symbol(q, Decl(b.ts, 0, 22), Decl(b.ts, 2, 22)) | ||
|
||
q.val = f(); | ||
>q.val : Symbol(q.val, Decl(b.ts, 2, 22)) | ||
>q : Symbol(q, Decl(b.ts, 0, 22), Decl(b.ts, 2, 22)) | ||
>val : Symbol(q.val, Decl(b.ts, 2, 22)) | ||
>f : Symbol(f, Decl(b.ts, 0, 8)) | ||
|
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.types
This file contains hidden or 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,22 @@ | ||
=== tests/cases/compiler/a.ts === | ||
interface I {} | ||
export function f(): I { return null as I; } | ||
>f : () => I | ||
>null as I : I | ||
>null : null | ||
|
||
=== tests/cases/compiler/b.ts === | ||
import {f} from "./a"; | ||
>f : () => I | ||
|
||
export function q() {} | ||
>q : typeof q | ||
|
||
q.val = f(); | ||
>q.val = f() : I | ||
>q.val : I | ||
>q : typeof q | ||
>val : I | ||
>f() : I | ||
>f : () => I | ||
|
9 changes: 9 additions & 0 deletions
9
tests/cases/compiler/declarationEmitExpandoPropertyPrivateName.ts
This file contains hidden or 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,9 @@ | ||
// @declaration: true | ||
// @filename: a.ts | ||
interface I {} | ||
export function f(): I { return null as I; } | ||
// @filename: b.ts | ||
import {f} from "./a"; | ||
|
||
export function q() {} | ||
q.val = f(); |
2 changes: 1 addition & 1 deletion
2
tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
Submodule TypeScript-Node-Starter
updated
49 files
Submodule prettier
updated
1906 files
Submodule webpack
updated
1279 files
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know this part of the codebase, but I don't get why you're not stashing into
oldDiag
first.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we already stashed it for the context we made for the associated function declaration ❤️