aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/config/Config.scala
blob: 46b1896f1add7450b010bef81f1b54a634199883 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
package dotty.tools.dotc.config

object Config {

  final val cacheMembersNamed = true
  final val cacheAsSeenFrom = true
  final val useFingerPrints = true // note: it currently seems to be slightly faster not to use them! my junit test: 548s without, 560s with.
  final val cacheMemberNames = true
  final val cacheImplicitScopes = true

  final val checkCacheMembersNamed = false

  /** When updating a constraint bound, check that the constrained parameter
   *  does not appear at the top-level of either of its bounds.
   */
  final val checkConstraintsNonCyclic = false

  /** Make sure none of the bounds of a parameter in an OrderingConstraint
   *  contains this parameter at its toplevel (i.e. as an operand of a
   *  combination of &'s and |'s.). The check is performed each time a new bound
   *  is added to the constraint.
   */
  final val checkConstraintsSeparated = false

  /** Check that each constraint resulting from a subtype test
   *  is satisfiable.
   */
  final val checkConstraintsSatisfiable = false

  /** Check that each constraint is fully propagated. i.e.
   *  If P <: Q then the upper bound of P is a subtype of the upper bound of Q
   *  and the lower bound of Q is a subtype of the lower bound of P.
   */
  final val checkConstraintsPropagated = false

  /** Check that constraints of globally committable typer states are closed.
   *  NOTE: When enabled, the check can cause CyclicReference errors because
   *  it traverses all elements of a type. Such failures were observed when
   *  compiling all of dotty together (source seems to be in GenBCode which
   *  accesses javac's settings.)
   *
   *  It is recommended to turn this option on only when chasing down
   *  a TypeParamRef instantiation error. See comment in Types.TypeVar.instantiate.
   */
  final val debugCheckConstraintsClosed = false

  /** Check that no type appearing as the info of a SymDenotation contains
   *  skolem types.
   */
  final val checkNoSkolemsInInfo = false

  /** Type comparer will fail with an assert if the upper bound
   *  of a constrained parameter becomes Nothing. This should be turned
   *  on only for specific debugging as normally instantiation to Nothing
   *  is not an error consdition.
   */
  final val failOnInstantiationToNothing = false

  /** Enable noDoubleDef checking if option "-YnoDoubleDefs" is set.
    * The reason to have an option as well as the present global switch is
    * that the noDoubleDef checking is done in a hotspot, and we do not
    * want to incur the overhead of checking an option each time.
    */
  final val checkNoDoubleBindings = true

  /** Check positions for consistency after parsing */
  final val checkPositions = true

  /** Show subtype traces for all deep subtype recursions */
  final val traceDeepSubTypeRecursions = false

  /** When explaining subtypes and this flag is set, also show the classes of the compared types. */
  final val verboseExplainSubtype = true

  /** If this flag is set, take the fast path when comparing same-named type-aliases and types */
  final val fastPathForRefinedSubtype = true

  /** If this flag is set, and we compute `T1 { X = S1 }` & `T2 { X = S2 }` as a new
   *  upper bound of a constrained parameter, try to align the refinements by computing
   *  `S1 =:= S2` (which might instantiate type parameters).
   *  This rule is contentious because it cuts the constraint set.
   *
   *  For more info, see the comment in `TypeComparer#distributeAnd`.
   */
  final val alignArgsInAnd = true

  /** If this flag is set, higher-kinded applications are checked for validity
   */
  final val checkHKApplications = false

  /** If this flag is set, method types are checked for valid parameter references
   */
  final val checkMethodTypes = false

  /** The recursion depth for showing a summarized string */
  final val summarizeDepth = 2

  /** Check that variances of lambda arguments match the
   *  variance of the underlying lambda class.
   */
  final val checkLambdaVariance = false

  /** Check that certain types cannot be created in erasedTypes phases.
   *  Note: Turning this option on will get some false negatives, since it is
   *  possible that And/Or types are still created during erasure as the result
   *  of some operation on an existing type.
   */
  final val checkUnerased = false

  /** In `derivedSelect`, rewrite
   *
   *      (S & T)#A  -->  S#A & T#A
   *      (S | T)#A  -->  S#A | T#A
   *
   *  Not sure whether this is useful. Preliminary measurements show a slowdown of about
   *  7% for the build when this option is enabled.
   */
  final val splitProjections = false

  /** If this flag is on, always rewrite an application `S[Ts]` where `S` is an alias for
   *  `[Xs] -> U` to `[Xs := Ts]U`.
   *  Turning this flag on was observed to give a ~6% speedup on the JUnit test suite.
   */
  final val simplifyApplications = true

  /** Initial size of superId table */
  final val InitialSuperIdsSize = 4096

  /** Initial capacity of uniques HashMap */
  final val initialUniquesCapacity = 40000

  /** How many recursive calls to NamedType#underlying are performed before logging starts. */
  final val LogPendingUnderlyingThreshold = 50

  /** How many recursive calls to isSubType are performed before logging starts. */
  final val LogPendingSubTypesThreshold = 50

  /** How many recursive calls to findMember are performed before logging names starts
   *  Note: this threshold has to be chosen carefully. Too large, and programs
   *  like tests/pos/IterableSelfRec go into polynomial (or even exponential?)
   *  compile time slowdown. Too small and normal programs will cause the compiler  to
   *  do inefficient operations on findMember. The current value is determined
   *  so that (1) IterableSelfRec still compiles in reasonable time (< 10sec) (2) Compiling
   *  dotty itself only causes small pending names lists to be generated (we measured
   *  at max 6 elements) and these lists are never searched with contains.
   */
  final val LogPendingFindMemberThreshold = 10

  /** Maximal number of outstanding recursive calls to findMember before backing out
   *  when findMemberLimit is set.
   */
  final val PendingFindMemberLimit = LogPendingFindMemberThreshold * 4
}