-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Report fewer spurious cyclic errors #10626
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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.
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.
lock
always succeeded. This overload ofcheckNonCyclic
is invoked right aftercheckNotLocked
.