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

Identical expressions yield inconsistent values across selectDynamic #6327

Closed
scabug opened this issue Sep 6, 2012 · 3 comments
Closed

Identical expressions yield inconsistent values across selectDynamic #6327

scabug opened this issue Sep 6, 2012 · 3 comments

Comments

@scabug
Copy link

@scabug scabug commented Sep 6, 2012

Compiling and running the attached source produces the output:
A
A
A
B

whilst all four expressions should be identical.

It appears that different types are being inferred for T in selectDynamic[T] depending on whether it is called explicitly, and whether the expression is then assigned.

There probably exist simpler test cases which don't involve implicits, though this one clearly demonstrates the issue.

@scabug
Copy link
Author

@scabug scabug commented Sep 6, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6327?orig=1
Reporter: @propensive
Affected Versions: 2.10.0-M4, 2.10.0-M7
Other Milestones: 2.10.0
Attachments:

@scabug
Copy link
Author

@scabug scabug commented Sep 6, 2012

@retronym said:
"It appears that...."

You don't need to guess:

scalac -Xprint:typer /Users/jason/Downloads/inconsistent.scala
...
    private[this] val b: DynTest.B = new DynTest.this.B();
    <stable> <accessor> def b: DynTest.B = DynTest.this.b;
    DynTest.this.b.selectDynamic[String]("baz")(DynTest.this.R.StringR);
    DynTest.this.b.selectDynamic[String]("baz")(DynTest.this.R.StringR);
    private[this] val c: Unit = DynTest.this.b.selectDynamic[String]("baz")(DynTest.this.R.StringR);
    <stable> <accessor> def c: Unit = DynTest.this.c;
    private[this] val d: Unit = DynTest.this.b.selectDynamic[Any]("baz")(DynTest.this.Default);
    <stable> <accessor> def d: Unit = DynTest.this.d
@scabug
Copy link
Author

@scabug scabug commented Oct 3, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants