Skip to content

Commit cbdda5f

Browse files
committed
Make TreeChecker happy
The failure comes from the tree checker, due to a limitation in subtyping checker: ``` dotty.tools.dotc.transform.init.Semantic.Hot.type | (dotty.tools.dotc.transform.init.Semantic.Hot.type | dotty.tools.dotc.transform.init.Semantic.Cold.type ) <: dotty.tools.dotc.transform.init.Semantic.Hot.type | dotty.tools.dotc.transform.init.Semantic.Cold.type = false ```
1 parent c1b83f6 commit cbdda5f

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

compiler/src/dotty/tools/dotc/transform/init/Semantic.scala

+12-11
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,10 @@ object Semantic {
422422

423423
/** Stop on first found error */
424424
def stopEarly(fn: Reporter ?=> Unit): List[Error] =
425-
// use promotion reporter to stop the analysis on the first error
426-
val promotionReporter: Reporter = new StopEarlyReporter
425+
val reporter: Reporter = new StopEarlyReporter
427426

428427
try
429-
fn(using promotionReporter)
428+
fn(using reporter)
430429
Nil
431430
catch case ex: ErrorFound =>
432431
ex.error :: Nil
@@ -629,7 +628,7 @@ object Semantic {
629628
case typeParamRef: TypeParamRef =>
630629
val bounds = typeParamRef.underlying.bounds
631630
val isWithinBounds = bounds.lo <:< defn.NothingType && defn.AnyType <:< bounds.hi
632-
def otherParamContains = allParamTypes.exists { param => param != info && param.typeSymbol != defn.ClassTagClass && info.occursIn(param) }
631+
def otherParamContains = allParamTypes.exists { param => param != typeParamRef && param.typeSymbol != defn.ClassTagClass && typeParamRef.occursIn(param) }
633632
// A non-hot method argument is allowed if the corresponding parameter type is a
634633
// type parameter T with Any as its upper bound and Nothing as its lower bound.
635634
// the other arguments should either correspond to a parameter type that is T
@@ -651,13 +650,15 @@ object Semantic {
651650
else
652651
if receiver.typeSymbol.isStaticOwner then
653652
val (errors, allArgsPromote) = checkArgsWithParametricity()
654-
if allArgsPromote then
655-
Hot
656-
else if errors.nonEmpty then
657-
for error <- errors do reporter.report(error)
658-
Hot
659-
else
660-
Cold
653+
val res: Value =
654+
if allArgsPromote then
655+
Hot
656+
else if errors.nonEmpty then
657+
for error <- errors do reporter.report(error)
658+
Hot
659+
else
660+
Cold
661+
res
661662
else
662663
checkArgs
663664
Hot

0 commit comments

Comments
 (0)