-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Disable distribution of intersection types over applied types #23441
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
16 commits
Select commit
Hold shift + click to select a range
9bb028d
Disable distribution of intersection types over applied types
EugeneFlesselle cba9856
Update zio community project
EugeneFlesselle 114a1d2
Update Lucre community project
EugeneFlesselle d0130ef
Update parallel-collections community project
EugeneFlesselle 07b7571
Update specs2 community project
EugeneFlesselle e064a1c
Update tests specifically about distributing intersections
EugeneFlesselle 942a747
Update tests relating to inheritance of conflicting instantiations
EugeneFlesselle 9ee56c5
Disable `TypeApplications#translateToRepeated` distribution of AndTypes
EugeneFlesselle 0441af0
Fix scala2-library-cc Sorted{Set,Map}FactoryDefaults self types
EugeneFlesselle a084779
Adapt context-bound-companion logic to use AndType of AppliedTypes
EugeneFlesselle 73214ff
Update docs reference/spec of intersection/union types
EugeneFlesselle 98dc4fb
Drop singletonInterval from TypeComparer lubArgs and glbArgs
EugeneFlesselle 6386817
Revert "Fix scala2-library-cc Sorted{Set,Map}FactoryDefaults self types"
EugeneFlesselle 2238324
Re-enable distributeAnd until source version 3.8
EugeneFlesselle f1bb4b3
Add `-source:3.8` option to all appropriate tests
EugeneFlesselle 1acde2c
Merge branch 'main' into distributeAnd
EugeneFlesselle 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
Submodule Lucre
updated
4 files
Submodule scala-parallel-collections
updated
1 files
+1 −1 | core/src/main/scala/scala/collection/parallel/ParSeqLike.scala |
Submodule specs2
updated
1 files
+1 −1 | common/shared/src/main/scala/org/specs2/collection/Iterablex.scala |
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
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
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 was deleted.
Oops, something went wrong.
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,7 @@ | ||
|
||
object Test: | ||
trait A[T] | ||
trait B1 extends A[Int] | ||
trait B2 extends A[String] | ||
class D extends B1, B2 // error: cannot be instantiated since it has conflicting base types Test.A[Int] and Test.A[String] | ||
// NOTE this is not accepted in Scala 2 either |
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
//> using options -source:3.8 | ||
|
||
type Or[+A, +B] = A | B | ||
|
||
val x: Or[Int, String] & Or[String, Int] = 3 | ||
val y: Or[Int & String, String & Int] = x // error | ||
val z: String = y |
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,17 @@ | ||
//> using options -source:3.8 | ||
|
||
trait L[+A]{val a:A} | ||
trait R[+B]{val b: B} | ||
|
||
class LR(val a: Int, val b: String) extends L[Int] with R[String] | ||
|
||
type E[+A] = L[A] | R[A] | ||
|
||
val x: E[Int] & E[String] = LR(4, "hi") | ||
val y: E[Int&String] = x // error | ||
|
||
val z = y match | ||
case l : L[Int&String] => l.a | ||
case r : R[Int&String] => r.b | ||
|
||
val _ = z:String // was: java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String |
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,15 @@ | ||
|
||
trait Txn[T] | ||
trait Expr[X <: Txn[X], +Y] | ||
trait BinOp[T, Repr[X <: Txn[X]] <: Expr[X, T]] | ||
|
||
trait IntObj[T] extends Expr[T, Int] | ||
trait IntBinOp extends BinOp[Int, IntObj] | ||
object IntEq extends IntBinOp | ||
|
||
object Test: | ||
val r: BinOp[?, ?] = IntEq : BinOp[Int, IntObj] // error: Required: BinOp[?, ?[X] <: Expr[X, BinOp[?, ?]#T]] | ||
// We would need the second wildcard to "depend" on the 1st one, | ||
// e.g. have SomeBinop[?] where `type SomeBinop[X] = BinOp[X, ? <: [Y] =>> Expr[Y, X]]`, | ||
// but this is an instance of an unreducible application of higher-kinded type to a wildcard argument. | ||
// Also note there would be no error if we made BinOp covariant in 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,17 @@ | ||
//> using options -source:3.8 | ||
|
||
/** Why the singletonInterval logic cannot be applied for lubArgs and glbArgs in TypeComparer. */ | ||
|
||
type Or[+A, +B] = A | B | ||
|
||
object TestGlb: | ||
val x: Or["3", Singleton] & Or[Singleton, "3"] = 3 | ||
val y: Or["3", "3"] = x // error | ||
val z: String = y | ||
|
||
object TestLub: | ||
def f[P[_, _]](x1: P["3", Singleton], x2: P[Singleton, "3"]): P["3", "3"] = | ||
val x = if true then x1 else x2 | ||
x // error, was accepted because inferred type of x was `P["3", "3"]` | ||
// by going through Types.join, TypeOps.mergeRefinedOrApplied, TypeComparer#lubArgs, TypeComparer#singletonInterval | ||
val z: String = f[Or](3, 3) |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.