@@ -17,16 +17,21 @@ import collection.mutable
17
17
private val Captures : Key [CaptureSet ] = Key ()
18
18
private val BoxedType : Key [BoxedTypeCache ] = Key ()
19
19
20
- /** Switch whether unpickled function types and byname types should be mapped to
21
- * impure types. With the new gradual typing using Fluid capture sets, this should
22
- * be no longer needed. Also, it has bad interactions with pickling tests.
23
- */
24
- private val adaptUnpickledFunctionTypes = false
20
+ object ccConfig :
25
21
26
- /** Switch whether we constrain a root var that includes the source of a
27
- * root map to be an alias of that source (so that it can be mapped)
28
- */
29
- private val constrainRootsWhenMapping = true
22
+ /** Switch whether unpickled function types and byname types should be mapped to
23
+ * impure types. With the new gradual typing using Fluid capture sets, this should
24
+ * be no longer needed. Also, it has bad interactions with pickling tests.
25
+ */
26
+ private [cc] val adaptUnpickledFunctionTypes = false
27
+
28
+ /** Switch whether we constrain a root var that includes the source of a
29
+ * root map to be an alias of that source (so that it can be mapped)
30
+ */
31
+ private [cc] val constrainRootsWhenMapping = true
32
+
33
+ val oldRefiningRoots = false
34
+ end ccConfig
30
35
31
36
def allowUniversalInBoxed (using Context ) =
32
37
Feature .sourceVersion.isAtLeast(SourceVersion .`3.3`)
@@ -86,7 +91,7 @@ class mapRoots(from0: CaptureRoot, to: CaptureRoot)(using Context) extends BiTyp
86
91
def apply (t : Type ): Type =
87
92
if t eq from then to
88
93
else t match
89
- case t : CaptureRoot .Var if constrainRootsWhenMapping && t.unifiesWith(from) =>
94
+ case t : CaptureRoot .Var if ccConfig. constrainRootsWhenMapping && t.unifiesWith(from) =>
90
95
to
91
96
case t @ Setup .Box (t1) =>
92
97
t.derivedBox(this (t1))
@@ -129,7 +134,7 @@ extension (tree: Tree)
129
134
* a by name parameter type, turning the latter into an impure by name parameter type.
130
135
*/
131
136
def adaptByNameArgUnderPureFuns (using Context ): Tree =
132
- if adaptUnpickledFunctionTypes && Feature .pureFunsEnabledSomewhere then
137
+ if ccConfig. adaptUnpickledFunctionTypes && Feature .pureFunsEnabledSomewhere then
133
138
val rbn = defn.RetainsByNameAnnot
134
139
Annotated (tree,
135
140
New (rbn.typeRef).select(rbn.primaryConstructor).appliedTo(
@@ -228,7 +233,7 @@ extension (tp: Type)
228
233
*/
229
234
def adaptFunctionTypeUnderPureFuns (using Context ): Type = tp match
230
235
case AppliedType (fn, args)
231
- if adaptUnpickledFunctionTypes && Feature .pureFunsEnabledSomewhere && defn.isFunctionClass(fn.typeSymbol) =>
236
+ if ccConfig. adaptUnpickledFunctionTypes && Feature .pureFunsEnabledSomewhere && defn.isFunctionClass(fn.typeSymbol) =>
232
237
val fname = fn.typeSymbol.name
233
238
defn.FunctionType (
234
239
fname.functionArity,
@@ -241,7 +246,7 @@ extension (tp: Type)
241
246
* a by name parameter type, turning the latter into an impure by name parameter type.
242
247
*/
243
248
def adaptByNameArgUnderPureFuns (using Context ): Type =
244
- if adaptUnpickledFunctionTypes && Feature .pureFunsEnabledSomewhere then
249
+ if ccConfig. adaptUnpickledFunctionTypes && Feature .pureFunsEnabledSomewhere then
245
250
AnnotatedType (tp,
246
251
CaptureAnnotation (CaptureSet .universal, boxed = false )(defn.RetainsByNameAnnot ))
247
252
else
0 commit comments