Skip to content

Commit

Permalink
Drop redundant exact distinction in Setup
Browse files Browse the repository at this point in the history
This is now redundant since result types of overriding ValDefs and DefDefs
are now mapped to TypeTrees in PostTyper.
  • Loading branch information
odersky committed Aug 8, 2024
1 parent 8584a9a commit a8cc133
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions compiler/src/dotty/tools/dotc/cc/Setup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,10 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
end transformExplicitType

/** Transform type of type tree, and remember the transformed type as the type the tree */
private def transformTT(tree: TypeTree, boxed: Boolean, exact: Boolean)(using Context): Unit =
private def transformTT(tree: TypeTree, boxed: Boolean)(using Context): Unit =
if !tree.hasRememberedType then
val transformed =
if tree.isInstanceOf[InferredTypeTree] && !exact
if tree.isInferred
then transformInferredType(tree.tpe)
else transformExplicitType(tree.tpe, tptToCheck = Some(tree))
tree.rememberType(if boxed then box(transformed) else transformed)
Expand Down Expand Up @@ -398,8 +398,6 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
&& !ccConfig.useSealed
&& !sym.hasAnnotation(defn.UncheckedCapturesAnnot),
// types of mutable variables are boxed in pre 3.3 code
exact = sym.allOverriddenSymbols.hasNext,
// types of symbols that override a parent don't get a capture set TODO drop
)
catch case ex: IllegalCaptureRef =>
capt.println(i"fail while transforming result type $tpt of $sym")
Expand Down Expand Up @@ -442,7 +440,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
traverse(fn)
if !defn.isTypeTestOrCast(fn.symbol) then
for case arg: TypeTree <- args do
transformTT(arg, boxed = true, exact = false) // type arguments in type applications are boxed
transformTT(arg, boxed = true) // type arguments in type applications are boxed

case tree: TypeDef if tree.symbol.isClass =>
val sym = tree.symbol
Expand All @@ -465,7 +463,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:

def postProcess(tree: Tree)(using Context): Unit = tree match
case tree: TypeTree =>
transformTT(tree, boxed = false, exact = false)
transformTT(tree, boxed = false)
case tree: ValOrDefDef =>
val sym = tree.symbol

Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
else keywordText("{{") ~ keywordText("/* inlined from ") ~ toText(call) ~ keywordText(" */") ~ bodyText ~ keywordText("}}")
case tpt: untpd.DerivedTypeTree =>
"<derived typetree watching " ~ tpt.watched.showSummary() ~ ">"
case TypeTree() =>
case tree: TypeTree =>
typeText(toText(tree.typeOpt))
~ Str("(inf)").provided(tree.isInstanceOf[InferredTypeTree] && printDebug)
~ Str("(inf)").provided(tree.isInferred && printDebug)
case SingletonTypeTree(ref) =>
toTextLocal(ref) ~ "." ~ keywordStr("type")
case RefinedTypeTree(tpt, refines) =>
Expand Down

0 comments on commit a8cc133

Please sign in to comment.