-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add line number magic comment support #23549
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 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b52e6b8
Add setting for specifying magic line number comment
Linyxus f5f2996
Offset line numbers when reporting given a magic comment
Linyxus f89d9cc
Add testcases
Linyxus d0ed711
Move magic header setting to -Y and add path setting
Linyxus 36aac1e
Cleanup
Linyxus 48c4322
Reposition span to original file for wrapper scripts
Linyxus 7eaf07a
Adapt test cases
Linyxus 438b4c1
Only shift spans in user code
Linyxus cc8b04a
Add test on missing original file
Linyxus 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
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,7 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/magic-offset-header-a.scala:6:19 ---------------------------------------------- | ||
1 |def test1(): Int = "无穷" // error | ||
| ^^^^ | ||
| Found: ("无穷" : String) | ||
| Required: Int | ||
| | ||
| longer explanation available when compiling with `-explain` |
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,6 @@ | ||
//> using options -Xmagic-offset-header:///TEST_MARKER | ||
val t1 = 1 | ||
val t2 = 2 | ||
val t3 = 3 | ||
///TEST_MARKER | ||
def test1(): Int = "无穷" // error |
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 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/magic-offset-header-b.scala:3:13 ---------------------------------------------- | ||
3 |def x: Int = true // error | ||
| ^^^^ | ||
| Found: (true : Boolean) | ||
| Required: Int | ||
| | ||
| longer explanation available when compiling with `-explain` | ||
-- [E007] Type Mismatch Error: tests/neg/magic-offset-header-b.scala:7:13 ---------------------------------------------- | ||
2 |def y: Int = false // error | ||
| ^^^^^ | ||
| Found: (false : Boolean) | ||
| Required: Int | ||
| | ||
| longer explanation available when compiling with `-explain` |
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,7 @@ | ||
//> using options -Xmagic-offset-header:///TEST_MARKER | ||
|
||
def x: Int = true // error | ||
|
||
///TEST_MARKER | ||
|
||
def y: Int = false // error |
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,7 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/magic-offset-header-c.scala:8:18 ---------------------------------------------- | ||
3 | val x: String = 0 // error | ||
| ^ | ||
| Found: (0 : Int) | ||
| Required: String | ||
| | ||
| longer explanation available when compiling with `-explain` |
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,8 @@ | ||
//> using options -Xmagic-offset-header:///SOURCE_CODE_START_MARKER | ||
|
||
val generatedCode = 123 | ||
|
||
///SOURCE_CODE_START_MARKER | ||
|
||
def userCode = | ||
val x: String = 0 // error |
Oops, something went wrong.
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 feel like it should be the in the
Y
category, so the experimental and tooling specific