Skip to content

Commit 946c7be

Browse files
committed
WIP widen 3
1 parent 0293b06 commit 946c7be

File tree

14 files changed

+30
-30
lines changed

14 files changed

+30
-30
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ case class Env(ctx: Context) {
4141
* It's true for primitive values
4242
*/
4343
def isAlwaysInitialized(tp: Type)(implicit env: Env): Boolean = {
44-
val sym = tp.widen.finalResultType.typeSymbol
44+
val sym = tp.widen.finalResultType.widen.typeSymbol
4545
sym.isPrimitiveValueClass || sym == defn.StringClass
4646
}
4747

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ class SpaceEngine(using Context) extends SpaceLogic {
486486
case tp @ RefinedType(parent, _, _) =>
487487
erase(parent)
488488

489-
case tref: TypeRef if tref.typeSymbol.isPatternBound =>
489+
case tref: TypeRef if tref.symbol.isPatternBound =>
490490
if (inArray) tref.underlying else WildcardType
491491

492492
case _ => tp

compiler/src/dotty/tools/dotc/transform/sjs/PrepJSInterop.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ class PrepJSInterop extends MacroTransform with IdentityDenotTransformer { thisP
315315

316316
// Check the parents
317317
for (parent <- sym.info.parents) {
318-
parent.typeSymbol match {
318+
parent.widen.typeSymbol match {
319319
case parentSym if parentSym == defn.ObjectClass =>
320320
// AnyRef is valid, except for non-native JS classes and objects
321321
if (!isJSNative && !sym.is(Trait)) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ object Applications {
116116
if (sel.exists) sel :: tupleSelectors(n + 1, tp) else Nil
117117
}
118118
def genTupleSelectors(n: Int, tp: Type): List[Type] = tp match {
119-
case tp: AppliedType if !defn.isTupleClass(tp.typeSymbol) && tp.derivesFrom(defn.PairClass) =>
119+
case tp: AppliedType if !defn.isTupleClass(tp.tycon.typeSymbol) && tp.derivesFrom(defn.PairClass) =>
120120
val List(head, tail) = tp.args
121121
head :: genTupleSelectors(n, tail)
122122
case _ => tupleSelectors(n, tp)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ trait Deriving {
9999
if (evidenceParamInfos.isEmpty) ExprType(resultType)
100100
else ImplicitMethodType(evidenceParamInfos.map(typeClassType.appliedTo), resultType)
101101
val derivedInfo = if (derivedParams.isEmpty) methodOrExpr else PolyType.fromParams(derivedParams, methodOrExpr)
102-
addDerivedInstance(originalTypeClassType.typeSymbol.name, derivedInfo, derived.srcPos)
102+
addDerivedInstance(originalTypeClassType.widen.typeSymbol.name, derivedInfo, derived.srcPos)
103103
}
104104

105105
def deriveSingleParameter: Unit = {
@@ -270,7 +270,7 @@ trait Deriving {
270270
/** The type class instance definition with symbol `sym` */
271271
def typeclassInstance(sym: Symbol)(using Context): List[Type] => (List[List[tpd.Tree]] => tpd.Tree) = {
272272
(tparamRefs: List[Type]) => (paramRefss: List[List[tpd.Tree]]) =>
273-
val tparams = tparamRefs.map(_.typeSymbol.asType)
273+
val tparams = tparamRefs.map(_.widen.typeSymbol.asType)
274274
val params = if (paramRefss.isEmpty) Nil else paramRefss.head.map(_.symbol.asTerm)
275275
tparams.foreach(ctx.enter(_))
276276
params.foreach(ctx.enter(_))

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,10 +876,10 @@ trait Implicits:
876876
}
877877

878878
case _ =>
879-
val userDefined = userDefinedMsg(pt.typeSymbol, defn.ImplicitNotFoundAnnot).map(raw =>
879+
val userDefined = userDefinedMsg(pt.widen.typeSymbol, defn.ImplicitNotFoundAnnot).map(raw =>
880880
err.userDefinedErrorString(
881881
raw,
882-
pt.typeSymbol.typeParams.map(_.name.unexpandedName.toString),
882+
pt.widen.typeSymbol.typeParams.map(_.name.unexpandedName.toString),
883883
pt.widenExpr.dropDependentRefinement.argInfos))
884884

885885
def hiddenImplicitsAddendum: String =

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ trait ImportSuggestions:
7575

7676
def rootsStrictlyIn(ref: Type)(using Context): List[TermRef] =
7777
val site = ref.widen
78-
val refSym = site.typeSymbol
78+
val refSym = site.widen.typeSymbol
7979
val nested =
8080
if refSym.is(Package) then
8181
if refSym == defn.EmptyPackageClass // Don't search the empty package

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ class Namer { typer: Typer =>
11501150
defn.ObjectType
11511151
}
11521152
else {
1153-
val pclazz = pt.typeSymbol
1153+
val pclazz = pt.widen.typeSymbol
11541154
if pclazz.is(Final) then
11551155
report.error(ExtendFinalClass(cls, pclazz), cls.srcPos)
11561156
else if pclazz.isEffectivelySealed && pclazz.associatedFile != cls.associatedFile then

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ trait QuotesAndSplices {
257257
patBuf += pat1
258258
}
259259
case Select(pat, _) if tree.symbol.isTypeSplice =>
260-
val sym = tree.tpe.dealias.typeSymbol
260+
val sym = tree.tpe.dealias.widen.typeSymbol
261261
if sym.exists then
262262
val tdef = TypeDef(sym.asType).withSpan(sym.span)
263263
freshTypeBindingsBuff += transformTypeBindingTypeDef(tdef, freshTypePatBuf)
@@ -327,9 +327,9 @@ trait QuotesAndSplices {
327327
val isFreshTypeBindings = freshTypeBindings.map(_.symbol).toSet
328328
val typeMap = new TypeMap() {
329329
def apply(tp: Type): Type = tp match {
330-
case tp: TypeRef if tp.typeSymbol.isTypeSplice =>
330+
case tp: TypeRef if tp.symbol.isTypeSplice =>
331331
val tp1 = tp.dealias
332-
if (isFreshTypeBindings(tp1.typeSymbol)) tp1
332+
if (isFreshTypeBindings(tp1.widen.typeSymbol)) tp1
333333
else tp
334334
case tp => mapOver(tp)
335335
}
@@ -408,8 +408,8 @@ trait QuotesAndSplices {
408408
class ReplaceBindings extends TypeMap() {
409409
override def apply(tp: Type): Type = tp match {
410410
case tp: TypeRef =>
411-
val tp1 = if (tp.typeSymbol.isTypeSplice) tp.dealias else tp
412-
mapOver(typeBindings.get(tp1.typeSymbol).fold(tp)(_.symbol.typeRef))
411+
val tp1 = if (tp.symbol.isTypeSplice) tp.dealias else tp
412+
mapOver(typeBindings.get(tp1.widen.typeSymbol).fold(tp)(_.symbol.typeRef))
413413
case tp => mapOver(tp)
414414
}
415415
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ object RefChecks {
311311
if (subOther(member.owner) && deferredCheck)
312312
//Console.println(infoString(member) + " shadows1 " + infoString(other) " in " + clazz);//DEBUG
313313
return
314-
val parentSymbols = clazz.info.parents.map(_.typeSymbol)
314+
val parentSymbols = clazz.info.parents.map(_.widen.typeSymbol)
315315
if (parentSymbols exists (p => subOther(p) && subMember(p) && deferredCheck))
316316
//Console.println(infoString(member) + " shadows2 " + infoString(other) + " in " + clazz);//DEBUG
317317
return
@@ -574,8 +574,8 @@ object RefChecks {
574574
mismatches match {
575575
// Only one mismatched parameter: say something useful.
576576
case (pa, pc) :: Nil =>
577-
val abstractSym = pa.typeSymbol
578-
val concreteSym = pc.typeSymbol
577+
val abstractSym = pa.widen.typeSymbol
578+
val concreteSym = pc.widen.typeSymbol
579579
def subclassMsg(c1: Symbol, c2: Symbol) =
580580
s": ${c1.showLocated} is a subclass of ${c2.showLocated}, but method parameter types must match exactly."
581581
val addendum =
@@ -1129,7 +1129,7 @@ class RefChecks extends MiniPhase { thisPhase =>
11291129

11301130
override def transformNew(tree: New)(using Context): New = {
11311131
val tpe = tree.tpe
1132-
val sym = tpe.typeSymbol
1132+
val sym = tpe.widen.typeSymbol
11331133
checkUndesiredProperties(sym, tree.srcPos)
11341134
currentLevel.enterReference(sym, tree.span)
11351135
tpe.dealias.foreachPart {

0 commit comments

Comments
 (0)