Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10626 from lrytz/t12814-retro
Report fewer spurious cyclic errors
- Loading branch information
Showing
9 changed files
with
335 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 @@ | ||
abstract class CharSet[P] { | ||
type Type <: P | ||
} | ||
|
||
object LetterOrDigit extends CharSet[Char] | ||
object Digit extends CharSet[LetterOrDigit.Type] | ||
|
||
object t { | ||
type D = Digit.Type | ||
} |
This file contains 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,43 @@ | ||
trait ScenarioParam { | ||
type Builder <: Type | ||
} | ||
|
||
trait ScenarioParamBuilder | ||
|
||
trait Type { | ||
type Builder <: ScenarioParamBuilder | ||
} | ||
|
||
trait Types[H <: ScenarioParam, T <: Type] extends Type { | ||
type Builder = H#Builder with T#Builder | ||
} | ||
|
||
trait Nil extends Type { | ||
type Builder = ScenarioParamBuilder | ||
} | ||
|
||
trait ScenarioTarget { | ||
type FilterParam <: Type | ||
} | ||
|
||
class P1 extends ScenarioParam | ||
class P2 extends ScenarioParam | ||
|
||
object someTarget extends ScenarioTarget { | ||
type FilterParam = Types[P1, Types[P2, Nil]] | ||
} | ||
|
||
class WhereClauseBuilder1[T <: ScenarioTarget] { | ||
type FilterBuilderType = T#FilterParam#Builder | ||
def m1(f: FilterBuilderType => Any): Any = null | ||
def m2(f: T#FilterParam#Builder => Any): Any = null | ||
} | ||
|
||
object t { | ||
(null: WhereClauseBuilder1[someTarget.type]).m1(x => null) | ||
|
||
val stabilizer: WhereClauseBuilder1[someTarget.type] = null | ||
stabilizer.m1(x => null) | ||
|
||
(null: WhereClauseBuilder1[someTarget.type]).m2(x => null) | ||
} |
This file contains 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,98 @@ | ||
// https://github.com/scala/bug/issues/12814#issuecomment-1822770100 | ||
object t1 { | ||
trait A[X] { type T = X } | ||
object B extends A[String] | ||
object C extends A[B.T] { | ||
def f: C.T = "hai" | ||
} | ||
} | ||
|
||
// https://github.com/scala/bug/issues/12814 | ||
object t2 { | ||
sealed trait Common | ||
sealed trait One extends Common | ||
sealed trait Two extends Common | ||
|
||
|
||
trait Module[C <: Common] { | ||
val name: String | ||
type Narrow = C | ||
def narrow: PartialFunction[Common, C] | ||
} | ||
|
||
object ModuleA extends Module[One] { | ||
val name = "A" | ||
val narrow: PartialFunction[Common, Narrow] = { | ||
case cc: Narrow => cc | ||
} | ||
} | ||
|
||
object ModuleB extends Module[ModuleA.Narrow] { | ||
val name = "B" | ||
val narrow: PartialFunction[Common, Narrow] = { | ||
case cc: Narrow => cc | ||
} | ||
} | ||
|
||
object ModuleC extends Module[Two] { | ||
val name = "C" | ||
val narrow: PartialFunction[Common, Narrow] = { | ||
case cc: Narrow => cc | ||
} | ||
} | ||
|
||
object ModuleD extends Module[One with Two] { | ||
val name = "D" | ||
val narrow: PartialFunction[Common, Narrow] = { | ||
case cc: Narrow => cc | ||
} | ||
} | ||
|
||
val one = new One {} | ||
val two = new Two {} | ||
val oneTwo = new One with Two {} | ||
|
||
Seq(ModuleA, ModuleB, ModuleC, ModuleD).foreach { module => | ||
println(s"${module.name} at One = ${module.narrow.isDefinedAt(one)}") | ||
println(s"${module.name} at Two = ${module.narrow.isDefinedAt(two)}") | ||
println(s"${module.name} at OneTwo = ${module.narrow.isDefinedAt(oneTwo)}") | ||
println("-" * 10) | ||
} | ||
} | ||
|
||
// https://github.com/scala/scala/pull/10457/files | ||
object t3 { | ||
sealed trait A | ||
|
||
sealed trait B extends A | ||
|
||
trait F[C] { | ||
type T = C | ||
} | ||
|
||
object O extends F[B] | ||
|
||
object P1 extends F[O.T] { | ||
val f: PartialFunction[A, P1.T] = { | ||
case x: P1.T => x | ||
} | ||
} | ||
|
||
object P2 extends F[O.T] { | ||
val f: PartialFunction[A, P2.T] = x => x match { | ||
case x: P2.T => x | ||
} | ||
} | ||
|
||
object P3 extends F[O.T] { | ||
val f: Function1[A, P3.T] = { | ||
case x: P3.T => x | ||
} | ||
} | ||
|
||
object P4 extends F[O.T] { | ||
val f: Function1[A, P4.T] = x => x match { | ||
case x: P4.T => x | ||
} | ||
} | ||
} |
Oops, something went wrong.