-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add -1 for any diagnostics using point() in Scala 3 #386
Conversation
d3c3fd9
to
be42a1e
Compare
be42a1e
to
32d4738
Compare
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.
just minor comments not even directly related to your changes, ignore if you want :)
fix LGTM 👍
@@ -166,7 +166,7 @@ class MarkdownCompiler( | |||
case (Right(start), Right(end)) => |
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.
pos: SourcePosition
<- will never be optional
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.
(comment not related to this line but parameter of this method)
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 have not noticed! Thanks and fixed!
@@ -166,7 +166,7 @@ class MarkdownCompiler( | |||
case (Right(start), Right(end)) => | |||
Position.Range(start.input, start.start, end.end).toUnslicedPosition |
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.
val position = pos.get
<- never used (not related to this exact line)
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.
Right! Fixed together with the previous one.
@@ -329,6 +329,23 @@ class WorksheetSuite extends BaseSuite { | |||
|""".stripMargin | |||
) | |||
|
|||
checkDiagnostics( | |||
"dotty-interpolation".tag(OnlyScala3), |
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.
rename test, one above is called the same
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.
Fixed!
32d4738
to
c5ae028
Compare
I will go ahead and merge. Might not be the best possible solution, but it fixes it for now and might not be an issue in the long run. I think point will mostly be needed to be used in cases when diagnostic is reported after a symbol. Alternative approach would be to modify edit distance to try to catch previous token if the one at the current position does not exist, but that would also change the bahaviour for Scala 2, which I don't want to currently do as the Scala 3 approach might still evolve. |
This came up in case of ambigous implicits:
diagnostic seems to be pointing to the place the parameters are supposed to be, which is not a real position. We need to do -1 in those cases, though not 100% sure it will work in every situation, but we can fix it as we find more issues.