Skip to content

Commit 11210c0

Browse files
committed
Make forwardParamBindings a Config setting
It was a command line setting before. But since we do not need to selective suppress param forwarding for making things compile anymore, it's better not to expose it as such.
1 parent 27be018 commit 11210c0

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

compiler/src/dotty/tools/dotc/config/Config.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ object Config {
7575
/** If this flag is set, take the fast path when comparing same-named type-aliases and types */
7676
final val fastPathForRefinedSubtype = true
7777

78+
/** If this flag is set, `TypeOps.normalizeToClassRefs` will insert forwarders
79+
* for type parameters of base classes. This is an optimization, which avoids
80+
* long alias chains. We should not rely on the optimization, though. So changing
81+
* the flag to false can be used for checking that everything works OK without it.
82+
*/
83+
final val forwardTypeParams = true
84+
7885
/** If this flag is set, and we compute `T1 { X = S1 }` & `T2 { X = S2 }` as a new
7986
* upper bound of a constrained parameter, try to align the refinements by computing
8087
* `S1 =:= S2` (which might instantiate type parameters).

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ class ScalaSettings extends Settings.SettingGroup {
9696
val YforceSbtPhases = BooleanSetting("-Yforce-sbt-phases", "Run the phases used by sbt for incremental compilation (ExtractDependencies and ExtractAPI) even if the compiler is ran outside of sbt, for debugging.")
9797
val YdumpSbtInc = BooleanSetting("-Ydump-sbt-inc", "For every compiled foo.scala, output the API representation and dependencies used for sbt incremental compilation in foo.inc, implies -Yforce-sbt-phases.")
9898
val YcheckAllPatmat = BooleanSetting("-Ycheck-all-patmat", "Check exhaustivity and redundancy of all pattern matching (used for testing the algorithm)")
99-
val YsuppressParamForwarding = BooleanSetting("-Ysuppress-param-forwarding", "Don't install aliases for base type parameters.")
10099

101100
/** Area-specific debug output */
102101
val Yexplainlowlevel = BooleanSetting("-Yexplain-lowlevel", "When explaining type errors, show types at a lower level.")

compiler/src/dotty/tools/dotc/core/TypeOps.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,9 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
400400
enterArgBinding(formals(name), refinedInfo, cls, decls)
401401
}
402402

403-
if (!ctx.settings.YsuppressParamForwarding.value)
403+
if (Config.forwardTypeParams)
404404
forwardParamBindings(parentRefs, refinements, cls, decls)
405-
405+
406406
parentRefs
407407
}
408408

0 commit comments

Comments
 (0)