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

macros and range position invariants #8064

Closed
scabug opened this issue Dec 10, 2013 · 2 comments
Closed

macros and range position invariants #8064

scabug opened this issue Dec 10, 2013 · 2 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Dec 10, 2013

Some macro tests fail under SCALAC_OPTS=-Yrange-pos

Example:

test/files/pos/annotated-original

[[syntax trees at end of                     typer]] // C_2.scala
[0:111]package [0:0]<empty> {
  [0:111]object Bug extends [11:111][111]scala.AnyRef {
    [111]def <init>(): [11]Bug.type = [111]{
      [111][111][111]Bug.super.<init>();
      [11]()
    };
    [19]([19]{
      [29]def s: [29]String = [33]"";
      [49]([43]([44]s: [43]Any): [NoPosition]([43]([44]s: [43]Any): [NoPosition]<type: [NoPosition][43]([44]s: [43]Any): @[49]unchecked>));
      [102][102]scala.this.Predef.???
    }: [19]Any)
  }
}

Note: we do have a range positions build, but that doesn't actually run tests with -Yrange-pos, only the distribution itself is compiled with that option.

In general, we don't expect all tests to work under both offset/range positions.

But, a few of the failing cases, such as that above, do indicate bugs.

What is the impact of such bugs?

Currently, they will crash a) the presentation compiler, and b) the build compiler with -Yrangepos set.

The first problem can be avoided altogether by our plan to return macro applications (attributed with the types of the macro expansion) in the presentation compiler.

For the second, we could try to find and fix problems, like this one. But, we might also consider demoting range positition validation crashes to warnings outside of the pres compiler.

Who uses range positions other than the IDE? I've seen some interest from macro authors themselves, who would like to get access to precise source code for macro argument trees.

@scabug
Copy link
Author

scabug commented Dec 10, 2013

Imported From: https://issues.scala-lang.org/browse/SI-8064?orig=1
Reporter: @retronym

@scabug
Copy link
Author

scabug commented Dec 18, 2013

@retronym said:
scala/scala#3287

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants