-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fix issue #5444 #5566
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
Fix issue #5444 #5566
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
63 changes: 63 additions & 0 deletions
63
tests/baselines/reference/overloadConsecutiveness.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,63 @@ | ||
tests/cases/compiler/overloadConsecutiveness.ts(3,10): error TS2391: Function implementation is missing or not immediately following the declaration. | ||
tests/cases/compiler/overloadConsecutiveness.ts(3,14): error TS1144: '{' or ';' expected. | ||
tests/cases/compiler/overloadConsecutiveness.ts(3,25): error TS2391: Function implementation is missing or not immediately following the declaration. | ||
tests/cases/compiler/overloadConsecutiveness.ts(4,10): error TS2391: Function implementation is missing or not immediately following the declaration. | ||
tests/cases/compiler/overloadConsecutiveness.ts(4,14): error TS1144: '{' or ';' expected. | ||
tests/cases/compiler/overloadConsecutiveness.ts(5,10): error TS2391: Function implementation is missing or not immediately following the declaration. | ||
tests/cases/compiler/overloadConsecutiveness.ts(5,17): error TS1128: Declaration or statement expected. | ||
tests/cases/compiler/overloadConsecutiveness.ts(5,28): error TS2391: Function implementation is missing or not immediately following the declaration. | ||
tests/cases/compiler/overloadConsecutiveness.ts(8,2): error TS2391: Function implementation is missing or not immediately following the declaration. | ||
tests/cases/compiler/overloadConsecutiveness.ts(8,6): error TS1144: '{' or ';' expected. | ||
tests/cases/compiler/overloadConsecutiveness.ts(8,8): error TS2391: Function implementation is missing or not immediately following the declaration. | ||
tests/cases/compiler/overloadConsecutiveness.ts(9,2): error TS2391: Function implementation is missing or not immediately following the declaration. | ||
tests/cases/compiler/overloadConsecutiveness.ts(9,6): error TS1144: '{' or ';' expected. | ||
tests/cases/compiler/overloadConsecutiveness.ts(10,2): error TS2391: Function implementation is missing or not immediately following the declaration. | ||
tests/cases/compiler/overloadConsecutiveness.ts(10,9): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. | ||
tests/cases/compiler/overloadConsecutiveness.ts(10,11): error TS2391: Function implementation is missing or not immediately following the declaration. | ||
|
||
|
||
==== tests/cases/compiler/overloadConsecutiveness.ts (16 errors) ==== | ||
// Making sure compiler won't break with declarations that are consecutive in the AST but not consecutive in the source. Syntax errors intentional. | ||
|
||
function f1(), function f1(); | ||
~~ | ||
!!! error TS2391: Function implementation is missing or not immediately following the declaration. | ||
~ | ||
!!! error TS1144: '{' or ';' expected. | ||
~~ | ||
!!! error TS2391: Function implementation is missing or not immediately following the declaration. | ||
function f2(), function f2() {} | ||
~~ | ||
!!! error TS2391: Function implementation is missing or not immediately following the declaration. | ||
~ | ||
!!! error TS1144: '{' or ';' expected. | ||
function f3() {}, function f3(); | ||
~~ | ||
!!! error TS2391: Function implementation is missing or not immediately following the declaration. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
~~ | ||
!!! error TS2391: Function implementation is missing or not immediately following the declaration. | ||
|
||
class C { | ||
m1(), m1(); | ||
~~ | ||
!!! error TS2391: Function implementation is missing or not immediately following the declaration. | ||
~ | ||
!!! error TS1144: '{' or ';' expected. | ||
~~ | ||
!!! error TS2391: Function implementation is missing or not immediately following the declaration. | ||
m2(), m2() {} | ||
~~ | ||
!!! error TS2391: Function implementation is missing or not immediately following the declaration. | ||
~ | ||
!!! error TS1144: '{' or ';' expected. | ||
m3() {}, m3(); | ||
~~ | ||
!!! error TS2391: Function implementation is missing or not immediately following the declaration. | ||
~ | ||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. | ||
~~ | ||
!!! error TS2391: Function implementation is missing or not immediately following the declaration. | ||
} | ||
|
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,27 @@ | ||
//// [overloadConsecutiveness.ts] | ||
// Making sure compiler won't break with declarations that are consecutive in the AST but not consecutive in the source. Syntax errors intentional. | ||
|
||
function f1(), function f1(); | ||
function f2(), function f2() {} | ||
function f3() {}, function f3(); | ||
|
||
class C { | ||
m1(), m1(); | ||
m2(), m2() {} | ||
m3() {}, m3(); | ||
} | ||
|
||
|
||
//// [overloadConsecutiveness.js] | ||
// Making sure compiler won't break with declarations that are consecutive in the AST but not consecutive in the source. Syntax errors intentional. | ||
function f2() { } | ||
function f3() { } | ||
var C = (function () { | ||
function C() { | ||
} | ||
C.prototype.m1 = ; | ||
C.prototype.m2 = ; | ||
C.prototype.m2 = function () { }; | ||
C.prototype.m3 = function () { }; | ||
return C; | ||
})(); |
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,11 @@ | ||
// Making sure compiler won't break with declarations that are consecutive in the AST but not consecutive in the source. Syntax errors intentional. | ||
|
||
function f1(), function f1(); | ||
function f2(), function f2() {} | ||
function f3() {}, function f3(); | ||
|
||
class C { | ||
m1(), m1(); | ||
m2(), m2() {} | ||
m3() {}, m3(); | ||
} |
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.
Can you add a comment that you need this test because garbage declarations may be introduced between overloads and cause issues according to our expectations
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.
Done