Skip to content

Fix line-ending empty interpolation #8267

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 1 commit into from
Feb 10, 2020
Merged

Conversation

som-snytt
Copy link
Contributor

Forward port fix from 2.11.

scala/scala@48413b4

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Have an awesome day! ☀️

@som-snytt som-snytt force-pushed the forward/7919 branch 2 times, most recently from 91783bf to 14774d0 Compare February 10, 2020 08:57
@som-snytt
Copy link
Contributor Author

My merge was thrown off by the absence of another commit.

Including scala/scala@a8edefc

I couldn't get neg/t5510.scala to work under vulpix because it reports an error past the last line of input; I think there is an escape hatch? but I haven't looked it up: error-nopos or similar. I wonder if the line counting problem was also fixed on Scala 2.

The error tries to be positioned on the last literal part (not sure that is optimal). That position should not be the opening quote mark, as in .22, when there is one part. (I'd expect either always caret at erroneous open quote, or at last position it expected a closer.) Correcting the position of the part aligns with Scala 2 for now.

Verifying manually; this is a 7-line file but last error is line 8:

sbt:dotty> dotc tests/neg/t5510.scala
[snip]
-- Error: tests/neg/t5510.scala:3:12 -------------------------------------------
3 |  def s = s"xxx  // error
  |            ^
  |            unclosed string literal
-- [E040] Syntax Error: tests/neg/t5510.scala:4:0 ------------------------------
4 |} // error
  |^
  |';' expected, but '}' found
-- [E080] Syntax Error: tests/neg/t5510.scala:5:0 ------------------------------
5 |trait U { // error
  |^^^^^^^^^^^^^^^^^^
  |Expected a toplevel definition
-- Error: tests/neg/t5510.scala:6:14 -------------------------------------------
6 |  def s = s"""xxx // error
  |              ^
  |              unclosed multi-line string literal
-- Error: tests/neg/t5510.scala:8:0 --------------------------------------------
8 |
  |^
  |unclosed multi-line string literal
5 errors found

@som-snytt
Copy link
Contributor Author

Or, the position fix causes position check failures. Maybe it was removed for a reason. I'll revert that and save it for another day.

Forward port fix from 2.11.

Also fix position of interpolated parts from 2.10.
@odersky odersky merged commit fe05020 into scala:master Feb 10, 2020
@som-snytt som-snytt deleted the forward/7919 branch February 10, 2020 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants