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 inference fails to find any common ancestor (higherKinds) #8882

Closed
scabug opened this issue Oct 5, 2014 · 2 comments
Closed

Type inference fails to find any common ancestor (higherKinds) #8882

scabug opened this issue Oct 5, 2014 · 2 comments

Comments

@scabug
Copy link

scabug commented Oct 5, 2014

The following code fails to compile due to what seems like incorrect type inference when two classes share a higher-kinded type ancestor.

import scala.language.higherKinds

class A[T[_]]
object B extends A[List]
object C extends A[Option]

// This compiles
val values = Seq[Any](B, C) 
// This doesn't
val values = Seq(B, C)

The error:

<console>:11: error: type mismatch;
 found   : B.type
 required: A[_ >: Option with List <: Product]
       val values = Seq(B, C)
                        ^
<console>:11: error: type mismatch;
 found   : C.type
 required: A[_ >: Option with List <: Product]
       val values = Seq(B, C)
                           ^

The expected behaviour, I would think, would be to infer the type of Any, as it would for Seq(B, 42).

@scabug
Copy link
Author

scabug commented Oct 5, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8882?orig=1
Reporter: Gal Topper (gtopper)
Affected Versions: 2.10.4, 2.11.0, 2.11.2
Duplicates #3528

@scabug
Copy link
Author

scabug commented Oct 6, 2014

@retronym said:
I'm going to merge this with #3528. Thanks for the tiny minimization.

joroKr21 added a commit to joroKr21/scala that referenced this issue Mar 14, 2018
When computing the `lub/glb` of HKTs take care to produce
well-kinded types. Improves type inference.

A few tests with `-Xstrict-inference` were changed.
Other tests reveal a limitation of higher-kinded existentials.

Fixes scala/bug#8882 and promotes scala/bug#10700 to an error.
joroKr21 added a commit to joroKr21/scala that referenced this issue Apr 24, 2018
When computing the `lub/glb` of HKTs take care to produce
well-kinded types. Improves type inference.

A few tests with `-Xstrict-inference` were changed.
Other tests reveal a limitation of higher-kinded existentials.

Fixes scala/bug#8882 and promotes scala/bug#10700 to an error.
joroKr21 added a commit to joroKr21/scala that referenced this issue Apr 25, 2018
When computing the `lub/glb` of HKTs take care to produce
well-kinded types. Improves type inference.

A few tests with `-Xstrict-inference` were changed.
Other tests reveal a limitation of higher-kinded existentials.

Fixes scala/bug#8882 and promotes scala/bug#10700 to an error.
joroKr21 added a commit to joroKr21/scala that referenced this issue Apr 25, 2018
When computing the `lub/glb` of HKTs take care to produce
well-kinded types. Improves type inference.

A few tests with `-Xstrict-inference` were changed.
Other tests reveal a limitation of higher-kinded existentials.

Fixes scala/bug#8882 and promotes scala/bug#10700 to an error.
joroKr21 added a commit to joroKr21/scala that referenced this issue Apr 25, 2018
When computing the `lub/glb` of HKTs take care to produce
well-kinded types. Improves type inference.

A few tests with `-Xstrict-inference` were changed.
Other tests reveal a limitation of higher-kinded existentials.

Fixes scala/bug#8882 and promotes scala/bug#10700 to an error.
joroKr21 added a commit to joroKr21/scala that referenced this issue May 26, 2018
When computing the `lub/glb` of HKTs take care to produce
well-kinded types. Improves type inference.

A few tests with `-Xstrict-inference` were changed.
Other tests reveal a limitation of higher-kinded existentials.

Fixes scala/bug#8882 and promotes scala/bug#10700 to an error.
adriaanm pushed a commit to joroKr21/scala that referenced this issue Aug 3, 2018
When computing the `lub/glb` of HKTs take care to produce
well-kinded types when merging type constructor arguments
that are supplied for a type constructor parameter.

This improves type inference.

A few tests with `-Xstrict-inference` were changed.
Other tests reveal a limitation of higher-kinded existentials.

Fixes scala/bug#8882 and promotes scala/bug#10700 to an error.
adriaanm pushed a commit to scala/scala that referenced this issue Aug 3, 2018
When computing the `lub/glb` of HKTs take care to produce
well-kinded types when merging type constructor arguments
that are supplied for a type constructor parameter.

This improves type inference.

A few tests with `-Xstrict-inference` were changed.
Other tests reveal a limitation of higher-kinded existentials.

Fixes scala/bug#8882 and promotes scala/bug#10700 to an error.
adriaanm pushed a commit to joroKr21/scala that referenced this issue Aug 6, 2018
When computing the `lub/glb` of HKTs take care to produce
well-kinded types when merging type constructor arguments
that are supplied for a type constructor parameter.

This improves type inference.

A few tests with `-Xstrict-inference` were changed.
Other tests reveal a limitation of higher-kinded existentials.

Fixes scala/bug#8882 and promotes scala/bug#10700 to an error.
@SethTisue SethTisue added this to the 2.13.0-M5 milestone Aug 7, 2018
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