-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Better errors for types with same name #1575
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
DanielRosenwasser
merged 11 commits into
microsoft:master
from
chrisbubernak:betterErrorsForTypesWithSameName
Jan 31, 2015
Merged
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fddc225
fixed checker and added a test case
chrisbubernak 82fcaa8
added baselines for new test case
chrisbubernak 07d3c20
updating baseines
chrisbubernak 5838900
remove commented out code
chrisbubernak 3b55a0c
removed errant text
chrisbubernak 8808a69
rewrote the fix to use a new type format flag and fixed the baselines…
chrisbubernak f39a25b
made some changes based cr feedback
chrisbubernak 52a6ba6
changed logic based on CR feedback to not get fully qualified for typ…
chrisbubernak ce794e8
more cr feedback: rename undefined flags param to None
chrisbubernak d35757d
fixing error in last checkin
chrisbubernak afc9f45
more changes based on CR feedback
chrisbubernak 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
tests/cases/compiler/clodulesDerivedClasses.ts(9,7): error TS2417: Class static side 'typeof Path' incorrectly extends base class static side 'typeof Shape'. | ||
Types of property 'Utils' are incompatible. | ||
Type 'typeof Utils' is not assignable to type 'typeof Utils'. | ||
Type 'Path.Utils' is not assignable to type 'Shape.Utils'. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is actually a regression - I think it should be |
||
Property 'convert' is missing in type 'typeof Utils'. | ||
|
||
|
||
|
@@ -17,7 +17,7 @@ tests/cases/compiler/clodulesDerivedClasses.ts(9,7): error TS2417: Class static | |
~~~~ | ||
!!! error TS2417: Class static side 'typeof Path' incorrectly extends base class static side 'typeof Shape'. | ||
!!! error TS2417: Types of property 'Utils' are incompatible. | ||
!!! error TS2417: Type 'typeof Utils' is not assignable to type 'typeof Utils'. | ||
!!! error TS2417: Type 'Path.Utils' is not assignable to type 'Shape.Utils'. | ||
!!! error TS2417: Property 'convert' is missing in type 'typeof Utils'. | ||
name: string; | ||
|
||
|
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/differentTypesWithSameName.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,22 @@ | ||
tests/cases/compiler/differentTypesWithSameName.ts(16,15): error TS2345: Argument of type 'variable' is not assignable to parameter of type 'm.variable'. | ||
|
||
|
||
==== tests/cases/compiler/differentTypesWithSameName.ts (1 errors) ==== | ||
module m { | ||
export class variable{ | ||
s: string; | ||
} | ||
export function doSomething(v: m.variable) { | ||
|
||
} | ||
} | ||
|
||
class variable { | ||
t: number; | ||
} | ||
|
||
|
||
var v: variable = new variable(); | ||
m.doSomething(v); | ||
~ | ||
!!! error TS2345: Argument of type 'variable' is not assignable to parameter of type 'm.variable'. |
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,38 @@ | ||
//// [differentTypesWithSameName.ts] | ||
module m { | ||
export class variable{ | ||
s: string; | ||
} | ||
export function doSomething(v: m.variable) { | ||
|
||
} | ||
} | ||
|
||
class variable { | ||
t: number; | ||
} | ||
|
||
|
||
var v: variable = new variable(); | ||
m.doSomething(v); | ||
|
||
//// [differentTypesWithSameName.js] | ||
var m; | ||
(function (m) { | ||
var variable = (function () { | ||
function variable() { | ||
} | ||
return variable; | ||
})(); | ||
m.variable = variable; | ||
function doSomething(v) { | ||
} | ||
m.doSomething = doSomething; | ||
})(m || (m = {})); | ||
var variable = (function () { | ||
function variable() { | ||
} | ||
return variable; | ||
})(); | ||
var v = new variable(); | ||
m.doSomething(v); |
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
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,16 @@ | ||
module m { | ||
export class variable{ | ||
s: string; | ||
} | ||
export function doSomething(v: m.variable) { | ||
|
||
} | ||
} | ||
|
||
class variable { | ||
t: number; | ||
} | ||
|
||
|
||
var v: variable = new variable(); | ||
m.doSomething(v); |
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 would write this as: