Skip to content
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

String interpolated parts get assigned with incorrect positions #7271

Closed
scabug opened this issue Mar 19, 2013 · 3 comments
Closed

String interpolated parts get assigned with incorrect positions #7271

scabug opened this issue Mar 19, 2013 · 3 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Mar 19, 2013

Last login: Tue Mar 19 09:37:02 on ttys001
09:37 ~$ 210x
09:37 ~/Projects/210x (2.10.x)$ parse -Xprint-pos 's"foo${bar}baz"'
[[syntax trees at end of parser]]// Scala source: tmpOh6bpd
[6]package [6]<empty> {
  [6]class wrapper extends [14][33]scala.AnyRef {
    [14]def <init>() = [14]{
      [14][14][14]super.<init>();
      [14]()
    };
    [16][16][16][16]StringContext([16]"foo", [16]"baz").s([23]bar)
  }
}
PackageDef(Ident(newTermName("<empty>")), List(ClassDef(Modifiers(), newTypeName("wrapper"), List(), Template(List(Select(Ident(scala), newTypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))), Apply(Select(Apply(Ident(newTermName("StringContext")), List(Literal(Constant("foo")), Literal(Constant("baz")))), newTermName("s")), List(Ident(newTermName("bar")))))))))

Note the [16] tokens next to "foo" and "baz". They mean that all those three trees are considered to originate from the beginning of the interpolated string, which is incorrect.

@scabug
Copy link
Author

scabug commented Mar 19, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7271?orig=1
Reporter: @xeno-by
Affected Versions: 2.10.0

@scabug
Copy link
Author

scabug commented Mar 20, 2013

@xeno-by said (edited on Apr 27, 2013 7:22:12 PM UTC):
scala/scala#2461

@scabug
Copy link
Author

scabug commented May 16, 2013

@xeno-by said:
scalamacros/kepler@a8edefc

@scabug scabug closed this as completed May 16, 2013
@scabug scabug added the has PR label Apr 7, 2017
@scabug scabug added this to the 2.10.2-RC1 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants