Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
}

homogenize(tp) match {
case x: ConstantType if homogenizedView =>
return toText(x.widen)
case AppliedType(tycon, args) =>
val cls = tycon.typeSymbol
if (tycon.isRepeatedParam) return toTextLocal(args.head) ~ "*"
Expand Down Expand Up @@ -544,6 +542,15 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
// add type to term nodes; replace type nodes with their types unless -Yprint-pos is also set.
def tp = tree.typeOpt match {
case tp: TermRef if tree.isInstanceOf[RefTree] && !tp.denot.isOverloaded => tp.underlying
case tp: ConstantType if homogenizedView =>
// constant folded types are forgotten in Tasty, are reconstituted subsequently in FirstTransform.
// Therefore we have to gloss over this when comparing before/after pickling by widening to
// underlying type `T`, or, if expression is a unary primitive operation, to `=> T`.
tree match {
case Select(qual, _) if qual.typeOpt.widen.typeSymbol.isPrimitiveValueClass =>
ExprType(tp.widen)
case _ => tp.widen
}
case tp => tp
}
if (!suppressTypes)
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ class Typer extends Namer
val qual1 = typedExpr(tree.qualifier, selectionProto(tree.name, pt, this))
if (tree.name.isTypeName) checkStable(qual1.tpe, qual1.pos)
val select = typedSelect(tree, pt, qual1)
if (select.tpe ne TryDynamicCallType) checkStableIdentPattern(select, pt)
if (select.tpe ne TryDynamicCallType) ConstFold(checkStableIdentPattern(select, pt))
else if (pt.isInstanceOf[PolyProto] || pt.isInstanceOf[FunProto] || pt == AssignProto) select
else typedDynamicSelect(tree, Nil, pt)
}
Expand Down