@@ -15,6 +15,12 @@ import config.Feature
15
15
private val Captures : Key [CaptureSet ] = Key ()
16
16
private val BoxedType : Key [BoxedTypeCache ] = Key ()
17
17
18
+ /** Switch whether unpickled function types and byname types should be mapped to
19
+ * impure types. With the new gradual typing using Fluid capture sets, this should
20
+ * be no longer needed. Also, it has bad interactions with pickling tests.
21
+ */
22
+ private val adaptUnpickledFunctionTypes = false
23
+
18
24
/** The arguments of a @retains or @retainsByName annotation */
19
25
private [cc] def retainedElems (tree : Tree )(using Context ): List [Tree ] = tree match
20
26
case Apply (_, Typed (SeqLiteral (elems, _), _) :: Nil ) => elems
@@ -49,7 +55,7 @@ extension (tree: Tree)
49
55
* a by name parameter type, turning the latter into an impure by name parameter type.
50
56
*/
51
57
def adaptByNameArgUnderPureFuns (using Context ): Tree =
52
- if Feature .pureFunsEnabledSomewhere then
58
+ if adaptUnpickledFunctionTypes && Feature .pureFunsEnabledSomewhere then
53
59
val rbn = defn.RetainsByNameAnnot
54
60
Annotated (tree,
55
61
New (rbn.typeRef).select(rbn.primaryConstructor).appliedTo(
@@ -145,7 +151,7 @@ extension (tp: Type)
145
151
*/
146
152
def adaptFunctionTypeUnderPureFuns (using Context ): Type = tp match
147
153
case AppliedType (fn, args)
148
- if Feature .pureFunsEnabledSomewhere && defn.isFunctionClass(fn.typeSymbol) =>
154
+ if adaptUnpickledFunctionTypes && Feature .pureFunsEnabledSomewhere && defn.isFunctionClass(fn.typeSymbol) =>
149
155
val fname = fn.typeSymbol.name
150
156
defn.FunctionType (
151
157
fname.functionArity,
0 commit comments