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

Nothing no more inferred #8237

Closed
scabug opened this issue Feb 5, 2014 · 5 comments
Closed

Nothing no more inferred #8237

scabug opened this issue Feb 5, 2014 · 5 comments

Comments

@scabug
Copy link

scabug commented Feb 5, 2014

import scala.language.higherKinds
import scala.reflect.runtime.universe._
type EI[X] = List[X]
def fTt[A,E[X]<:EI[X]](a: A)(implicit tt: TypeTag[E[A]]) = a

/* 2.10.1    : Nothing inferred
 * 2.10.4-RC1: Compiler crashes
 * 2.11.0-M8 : "error: no type parameters for method fTt"
*/
fTt(1)

I feel Nothing should be inferred. Interestingly, the same has been working with Manifest in any release:

def fMf[A,E[X]<:EI[X]](a: A)(implicit mf: Manifest[E[A]]) = a
fMf(1)
@scabug
Copy link
Author

scabug commented Feb 5, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8237?orig=1
Reporter: Sonnenschein (sonnenschein)
Affected Versions: 2.10.4-RC1, 2.11.0-M8
See #7226

@scabug
Copy link
Author

scabug commented Feb 5, 2014

@retronym said:
Started crashing in 2.10.x as a result of the fix: #7226 / 221f52757aa64d47

Stopped crasshing on master after this merge 3bd897ba0054fd2cfd580c7f87ff6488c9dca4ea (from 2.10.x)

@scabug
Copy link
Author

scabug commented Feb 5, 2014

@retronym said:
I believe the root problem here stems from us having multiple, distinct AppliedTypeVars over the same HKTypeRef.

Here's an (ugly) patch in which I detect if we try to relate two such instances, and I ignore it.

https://github.com/retronym/scala/compare/ticket;8237?expand=1

After that, we end up lubbing an empty list of constraints and getting the desired Nothing.

Without it, we end up with a cyclic error in type var bounds after we solve and when we try to instantiate.

Maybe they should be uniqued into the same TypeVar.

@scabug
Copy link
Author

scabug commented Feb 5, 2014

@adriaanm said (edited on Feb 5, 2014 7:58:17 PM UTC):
This sharing of typerefs is intentional (though perhaps not optimal). I'm sure you know, but just in case: https://github.com/scala/scala/blob/master/src/reflect/scala/reflect/internal/Types.scala#L2967

Your patch does not seem at odds, since the sharing is only relevant to applyArgs, not for bounds-tracking.

@scabug
Copy link
Author

scabug commented Feb 7, 2014

@retronym said:
scala/scala#3484

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