-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report duplicate identifier errors on all locations for merged declar…
…ations to align with local declarations
- Loading branch information
Showing
21 changed files
with
161 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,6 +226,9 @@ module ts { | |
forEach(source.declarations, node => { | ||
error(node.name ? node.name : node, Diagnostics.Duplicate_identifier_0, symbolToString(source)); | ||
}); | ||
forEach(target.declarations, node => { | ||
error(node.name ? node.name : node, Diagnostics.Duplicate_identifier_0, symbolToString(source)); | ||
}); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mhegazy
Author
Contributor
|
||
} | ||
} | ||
|
||
|
15 changes: 0 additions & 15 deletions
15
tests/baselines/reference/functionTypeArgumentArrayAssignment.errors.txt
This file was deleted.
Oops, something went wrong.
23 changes: 14 additions & 9 deletions
23
tests/baselines/reference/functionTypeArgumentArrayAssignment.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 |
---|---|---|
@@ -1,15 +1,20 @@ | ||
//// [functionTypeArgumentArrayAssignment.ts] | ||
interface Array<T> { | ||
foo: T; | ||
length: number; | ||
} | ||
module test { | ||
interface Array<T> { | ||
foo: T; | ||
length: number; | ||
} | ||
|
||
function map<U>() { | ||
var ys: U[] = []; | ||
function map<U>() { | ||
var ys: U[] = []; | ||
} | ||
} | ||
|
||
|
||
//// [functionTypeArgumentArrayAssignment.js] | ||
function map() { | ||
var ys = []; | ||
} | ||
var test; | ||
(function (test) { | ||
function map() { | ||
var ys = []; | ||
} | ||
})(test || (test = {})); |
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/functionTypeArgumentArrayAssignment.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,27 @@ | ||
=== tests/cases/compiler/functionTypeArgumentArrayAssignment.ts === | ||
module test { | ||
>test : typeof test | ||
|
||
interface Array<T> { | ||
>Array : Array<T> | ||
>T : T | ||
|
||
foo: T; | ||
>foo : T | ||
>T : T | ||
|
||
length: number; | ||
>length : number | ||
} | ||
|
||
function map<U>() { | ||
>map : <U>() => void | ||
>U : U | ||
|
||
var ys: U[] = []; | ||
>ys : U[] | ||
>U : U | ||
>[] : U[] | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -1,43 +1,42 @@ | ||
tests/cases/compiler/instanceofOperator.ts(6,7): error TS2300: Duplicate identifier 'Object'. | ||
tests/cases/compiler/instanceofOperator.ts(11,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. | ||
tests/cases/compiler/instanceofOperator.ts(14,16): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. | ||
tests/cases/compiler/instanceofOperator.ts(15,19): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. | ||
tests/cases/compiler/instanceofOperator.ts(18,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. | ||
tests/cases/compiler/instanceofOperator.ts(20,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. | ||
tests/cases/compiler/instanceofOperator.ts(12,5): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. | ||
tests/cases/compiler/instanceofOperator.ts(15,20): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. | ||
tests/cases/compiler/instanceofOperator.ts(16,23): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. | ||
tests/cases/compiler/instanceofOperator.ts(19,5): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. | ||
tests/cases/compiler/instanceofOperator.ts(21,5): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. | ||
|
||
|
||
==== tests/cases/compiler/instanceofOperator.ts (6 errors) ==== | ||
==== tests/cases/compiler/instanceofOperator.ts (5 errors) ==== | ||
// Spec: | ||
// The instanceof operator requires the left operand to be of type Any or an object type, and the right | ||
// operand to be of type Any or a subtype of the ‘Function’ interface type. The result is always of the | ||
// Boolean primitive type. | ||
|
||
class Object { } | ||
~~~~~~ | ||
!!! error TS2300: Duplicate identifier 'Object'. | ||
var obj: Object; | ||
module test { | ||
class Object { } | ||
var obj: Object; | ||
|
||
|
||
|
||
4 instanceof null; | ||
~ | ||
4 instanceof null; | ||
~ | ||
!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. | ||
|
||
// Error and should be error | ||
obj instanceof 4; | ||
~ | ||
// Error and should be error | ||
obj instanceof 4; | ||
~ | ||
!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. | ||
Object instanceof obj; | ||
~~~ | ||
Object instanceof obj; | ||
~~~ | ||
!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. | ||
|
||
// Error on left hand side | ||
null instanceof null; | ||
~~~~ | ||
// Error on left hand side | ||
null instanceof null; | ||
~~~~ | ||
!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. | ||
obj instanceof Object; | ||
undefined instanceof undefined; | ||
~~~~~~~~~ | ||
obj instanceof Object; | ||
undefined instanceof undefined; | ||
~~~~~~~~~ | ||
!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. | ||
} | ||
|
||
|
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
5 changes: 4 additions & 1 deletion
5
tests/baselines/reference/letDeclarations-scopes-duplicates2.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
5 changes: 4 additions & 1 deletion
5
tests/baselines/reference/letDeclarations-scopes-duplicates3.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
5 changes: 4 additions & 1 deletion
5
tests/baselines/reference/letDeclarations-scopes-duplicates4.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
5 changes: 4 additions & 1 deletion
5
tests/baselines/reference/letDeclarations-scopes-duplicates5.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
5 changes: 4 additions & 1 deletion
5
tests/baselines/reference/letDeclarations-scopes-duplicates6.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
5 changes: 4 additions & 1 deletion
5
tests/baselines/reference/letDeclarations-scopes-duplicates7.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
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
tests/baselines/reference/parserOptionalTypeMembers1.errors.txt
This file was deleted.
Oops, something went wrong.
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
23 changes: 23 additions & 0 deletions
23
tests/baselines/reference/parserOptionalTypeMembers1.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,23 @@ | ||
=== tests/cases/conformance/parser/ecmascript5/parserOptionalTypeMembers1.ts === | ||
interface PropertyDescriptor2 { | ||
>PropertyDescriptor2 : PropertyDescriptor2 | ||
|
||
configurable?: boolean; | ||
>configurable : boolean | ||
|
||
enumerable?: boolean; | ||
>enumerable : boolean | ||
|
||
value?: any; | ||
>value : any | ||
|
||
writable?: boolean; | ||
>writable : boolean | ||
|
||
get?(): any; | ||
>get : () => any | ||
|
||
set?(v: any): void; | ||
>set : (v: any) => void | ||
>v : any | ||
} |
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
Oops, something went wrong.
I like that we're now doing this. So, if for example I declare my own
Array<T>
with alength
property I would see a duplicate error both on my declaration and the one in lib.d.ts, right? I can't tell from the tests below.Should we also be doing this for declarations that are merged during local binding?