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

type conformance (or inference) difference between 2.9.2 and 2.10 #5777

Closed
scabug opened this issue May 9, 2012 · 7 comments
Closed

type conformance (or inference) difference between 2.9.2 and 2.10 #5777

scabug opened this issue May 9, 2012 · 7 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented May 9, 2012

I happened across this while poking at #5340.

trait Ring {
  trait E
}

class Poly[C <: Ring](val ring: C) extends Ring
// This definition of Poly triggers the same failure on *both* versions
// class Poly(val ring: Ring) extends Ring

object BigInt extends Ring

object MyApp {
  val r = new Poly(BigInt)

  // fail on 2.10, works on 2.9.2
  (null.asInstanceOf[BigInt.E] : r.ring.E)

  // works on both versions
  val r1 = new Poly[BigInt.type](BigInt)
  (null.asInstanceOf[BigInt.E] : r1.ring.E)

  // Oddly, -Xprint:typer reports that r and r1 have the same inferred type.
  //
  // private[this] val r: Poly[BigInt.type] = new Poly[BigInt.type](BigInt);
  // <stable> <accessor> def r: Poly[BigInt.type] = MyApp.this.r;
  // (null.asInstanceOf[BigInt.E]: MyApp.r.ring.E);
  // private[this] val r1: Poly[BigInt.type] = new Poly[BigInt.type](BigInt);
  // <stable> <accessor> def r1: Poly[BigInt.type] = MyApp.this.r1;
  // (null.asInstanceOf[BigInt.E]: MyApp.r1.ring.E)

  // diff typer-2.9.2.txt typer-2.10.txt
  // ...
  // ---
  // >   object MyApp extends scala.AnyRef {
  // >     def <init>(): MyApp.type = {
  // >       MyApp.super.<init>();
  // 30c30
  // <     scala.this.Predef.implicitly[<:<[BigInt.E,MyApp.r.ring.E]](scala.this.Predef.conforms[BigInt.E]);
  // ---
  // >     scala.this.Predef.implicitly[<:<[BigInt.E,MyApp.r.ring.E]]();
}
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented May 9, 2012

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented May 9, 2012

@paulp said:
Changed between M2 and M3. I strongly suspect virtpatmat.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented May 9, 2012

@paulp said:
Oh, this is only five weeks ago? Oops, I strongly suspect this then: a7f68ce32c

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented May 9, 2012

@paulp said:
Right, I removed the code which special cased inference for module classes so that "BigInt.type" would be inferred, because in theory it was no longer necessary as subtyping itself now captured the essence. But it seems there was a gap.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented May 9, 2012

@paulp said:
I got it, thanks for finding.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented May 9, 2012

@paulp said:
e8e88f785d

@scabug scabug closed this May 9, 2012
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented May 9, 2012

@retronym said:
Just glad that my proclivity for stumbling over things can be put to good use.

@scabug scabug added this to the 2.10.0 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.