File tree Expand file tree Collapse file tree 4 files changed +23
-9
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 4 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,10 @@ object Inferencing {
3333 */
3434 def isFullyDefined (tp : Type , force : ForceDegree .Value )(using Context ): Boolean = {
3535 val nestedCtx = ctx.fresh.setNewTyperState()
36- val result = new IsFullyDefinedAccumulator (force)(using nestedCtx).process(tp)
36+ val result =
37+ try new IsFullyDefinedAccumulator (force)(using nestedCtx).process(tp)
38+ catch case ex : StackOverflowError =>
39+ false // can happen for programs with illegal recusions, e.g. neg/recursive-lower-constraint.scala
3740 if (result) nestedCtx.typerState.commit()
3841 result
3942 }
@@ -43,7 +46,7 @@ object Inferencing {
4346 */
4447 def canDefineFurther (tp : Type )(using Context ): Boolean =
4548 val prevConstraint = ctx.typerState.constraint
46- isFullyDefined(tp, force = ForceDegree .all )
49+ isFullyDefined(tp, force = ForceDegree .failBottom )
4750 && (ctx.typerState.constraint ne prevConstraint)
4851
4952 /** The fully defined type, where all type variables are forced.
Original file line number Diff line number Diff line change 44 |Cannot construct a collection of type List[String] with elements of type Int based on a collection of type List[Int]..
55 |I found:
66 |
7- | collection.BuildFrom.buildFromIterableOps[Nothing, Nothing, Nothing ]
7+ | collection.BuildFrom.buildFromIterableOps[CC, A0, A ]
88 |
99 |But method buildFromIterableOps in trait BuildFromLowPriority2 does not match type collection.BuildFrom[List[Int], Int, List[String]].
Original file line number Diff line number Diff line change 1- -- [E008] Not Found Error: tests/neg/i7056.scala:19:10 --- --------------------------------------------------------------
1+ -- [E007] Type Mismatch Error: tests/neg/i7056.scala:19:8 --------------------------------------------------------------
2219 |val z = x.idnt1 // error
3- | ^^^^^^^
4- | value idnt1 is not a member of B.
5- | An extension method was tried, but could not be fully constructed:
3+ | ^
4+ | Found: (given_PartialId_B : B)
5+ | Required: PartialId[T]
66 |
7- | given_T1_T[T](given_PartialId_B).idnt1()
7+ | where: T is a type variable with constraint <: A
8+ |
9+ |
10+ | Note: a match type could not be fully reduced:
11+ |
12+ | trying to reduce PartialId[T]
13+ | failed since selector T
14+ | matches none of the cases
15+ |
16+ | case B => T
17+
18+ longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ object C {
66 trait X [T ]
77 implicit def u [A , B ]: X [A | B ] = new X [A | B ] {}
88 def y [T ](implicit x : X [T ]): T = ???
9- val x : a.type & b.type | b.type & c.type = y
9+ val x : a.type & b.type | b.type & c.type = y // error
1010}
You can’t perform that action at this time.
0 commit comments