Skip to content

Commit 910b581

Browse files
committed
WIP widen 4
1 parent 803ce81 commit 910b581

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,7 @@ class Typer extends Namer
12551255
// The resulting class `class $anon extends C[?] {...}` would be illegal,
12561256
// since type arguments to `C`'s super constructor cannot be constructed.
12571257
def isWildcardClassSAM =
1258-
!pt.classSymbol.is(Trait) && pt.argInfos.exists(_.isInstanceOf[TypeBounds])
1258+
!pt.widen.classSymbol.is(Trait) && pt.argInfos.exists(_.isInstanceOf[TypeBounds])
12591259
val targetTpe =
12601260
if isFullyDefined(pt, ForceDegree.all) && !isWildcardClassSAM then
12611261
pt
@@ -1265,9 +1265,9 @@ class Typer extends Namer
12651265
else
12661266
report.error(ex"result type of lambda is an underspecified SAM type $pt", tree.srcPos)
12671267
pt
1268-
if (pt.classSymbol.isOneOf(FinalOrSealed)) {
1269-
val offendingFlag = pt.classSymbol.flags & FinalOrSealed
1270-
report.error(ex"lambda cannot implement $offendingFlag ${pt.classSymbol}", tree.srcPos)
1268+
if (pt.widen.classSymbol.isOneOf(FinalOrSealed)) {
1269+
val offendingFlag = pt.widen.classSymbol.flags & FinalOrSealed
1270+
report.error(ex"lambda cannot implement $offendingFlag ${pt.widen.classSymbol}", tree.srcPos)
12711271
}
12721272
TypeTree(targetTpe)
12731273
case _ =>
@@ -2190,11 +2190,11 @@ class Typer extends Namer
21902190
case nil => defn.ObjectClass
21912191
}
21922192
def improve(candidate: ClassSymbol, parent: Type): ClassSymbol = {
2193-
val pcls = realClassParent(parent.classSymbol)
2193+
val pcls = realClassParent(parent.widen.classSymbol)
21942194
if (pcls derivesFrom candidate) pcls else candidate
21952195
}
21962196
parents match {
2197-
case p :: _ if p.classSymbol.isRealClass => parents
2197+
case p :: _ if p.widen.classSymbol.isRealClass => parents
21982198
case _ =>
21992199
val pcls = parents.foldLeft(defn.ObjectClass)(improve)
22002200
typr.println(i"ensure first is class $parents%, % --> ${parents map (_ baseType pcls)}%, %")
@@ -2205,7 +2205,7 @@ class Typer extends Namer
22052205

22062206
/** Ensure that first parent tree refers to a real class. */
22072207
def ensureFirstTreeIsClass(parents: List[Tree], span: Span)(using Context): List[Tree] = parents match {
2208-
case p :: ps if p.tpe.classSymbol.isRealClass => parents
2208+
case p :: ps if p.tpe.widen.classSymbol.isRealClass => parents
22092209
case _ => TypeTree(ensureFirstIsClass(parents.tpes, span).head).withSpan(span.focus) :: parents
22102210
}
22112211

@@ -3207,7 +3207,7 @@ class Typer extends Namer
32073207
!(isSyntheticApply(tree) && !isExpandableApply)) {
32083208
if (!defn.isFunctionType(pt))
32093209
pt match {
3210-
case SAMType(_) if !pt.classSymbol.hasAnnotation(defn.FunctionalInterfaceAnnot) =>
3210+
case SAMType(_) if !pt.widen.classSymbol.hasAnnotation(defn.FunctionalInterfaceAnnot) =>
32113211
report.warning(ex"${tree.symbol} is eta-expanded even though $pt does not have the @FunctionalInterface annotation.", tree.srcPos)
32123212
case _ =>
32133213
}
@@ -3226,7 +3226,7 @@ class Typer extends Namer
32263226
isContextFunctionRef(parent) // apply refinements indicate a dependent CFT
32273227
case _ =>
32283228
val underlying = wtp.underlyingClassRef(refinementOK = false) // other refinements are not OK
3229-
defn.isContextFunctionClass(underlying.classSymbol)
3229+
defn.isContextFunctionClass(underlying.widen.classSymbol)
32303230
}
32313231

32323232
def adaptNoArgsOther(wtp: Type): Tree = {

compiler/src/dotty/tools/dotc/util/Signatures.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ object Signatures {
8888
if (res.resultType.isParameterless &&
8989
res.isImplicitMethod &&
9090
res.paramInfos.forall(info =>
91-
info.classSymbol.derivesFrom(ctx.definitions.DummyImplicitClass)))
91+
info.widen.classSymbol.derivesFrom(ctx.definitions.DummyImplicitClass)))
9292
Nil
9393
else
9494
toParamss(res)

0 commit comments

Comments
 (0)