-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Improve partial unification handling #9523
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1fb2082
Print remaining tests in case of timeout
smarter 5fb13aa
Don't dealias when matching type constructors
smarter 968332e
Fix #9478: Improve partial unification handling
smarter cf849a6
Remove extraneous fourthTry
smarter 6c63f50
Generalize base class handling
smarter 64e8797
Add remaining SI-2712 testcases from Scala 2
smarter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
object Test extends App { | ||
class L[A] | ||
class Quux0[B, CC[_]] | ||
class Quux[C] extends Quux0[C, L] | ||
|
||
def foo[D[_]](x: D[D[Boolean]]) = ??? | ||
def bar: Quux[Int] = ??? | ||
|
||
foo(bar) // error: Found: Test.Quux[Int] Required: D[D[Boolean]] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class Foo[T[_, _], F[_], A, B](val fa: T[F[A], F[B]]) | ||
|
||
object Test { | ||
def x[T[_, _]](tmab: T[Either[Int, String], Either[Int, Int]]) = | ||
new Foo(tmab) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package test | ||
|
||
class X1 | ||
class X2 | ||
class X3 | ||
|
||
trait One[A] | ||
trait Two[A, B] | ||
|
||
class Foo extends Two[X1, X2] with One[X3] | ||
object Test { | ||
def test1[M[_], A](x: M[A]): M[A] = x | ||
|
||
val foo = new Foo | ||
|
||
test1(foo): One[X3] // fails in Scala 2 with partial unification enabled, works in Dotty | ||
test1(foo): Two[X1, X2] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class Two[A, B] | ||
class One[A] extends Two[A, A] | ||
|
||
object Test { | ||
def foo[F[_, _]](x: F[Int, Int]) = x | ||
|
||
val t: One[Int] = ??? | ||
foo(t) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
trait Bla[T] | ||
object Bla { | ||
implicit def blaInt: Bla[Int] = new Bla[Int] {} | ||
implicit def blaString: Bla[String] = new Bla[String] { | ||
assert(false, "I should not be summoned!") | ||
} | ||
} | ||
|
||
trait ErasedFoo[FT] | ||
object Test { | ||
type Foo[F[_], T] = ErasedFoo[F[T]] | ||
type Foo2[F[_], T] = Foo[F, T] | ||
|
||
def mkFoo[F[_], T](implicit gen: Bla[T]): Foo[F, T] = new Foo[F, T] {} | ||
def mkFoo2[F[_], T](implicit gen: Bla[T]): Foo2[F, T] = new Foo2[F, T] {} | ||
|
||
def main(args: Array[String]): Unit = { | ||
val a: Foo[[X] =>> (X, String), Int] = mkFoo | ||
val b: Foo2[[X] =>> (X, String), Int] = mkFoo | ||
val c: Foo[[X] =>> (X, String), Int] = mkFoo2 | ||
} | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice explanation!