@@ -216,15 +216,15 @@ object ProtoTypes {
216
216
*/
217
217
case class FunProto (args : List [untpd.Tree ], resType : Type , typer : Typer )(implicit ctx : Context )
218
218
extends UncachedGroundType with ApplyingProto {
219
- private [ this ] var myTypedArgs : List [Tree ] = Nil
219
+ private var myTypedArgs : List [Tree ] = Nil
220
220
221
221
override def resultType (implicit ctx : Context ) = resType
222
222
223
223
/** A map in which typed arguments can be stored to be later integrated in `typedArgs`. */
224
- private [ this ] var myTypedArg : SimpleIdentityMap [untpd.Tree , Tree ] = SimpleIdentityMap .Empty
224
+ private var myTypedArg : SimpleIdentityMap [untpd.Tree , Tree ] = SimpleIdentityMap .Empty
225
225
226
226
/** A map recording the typer states and constraints in which arguments stored in myTypedArg were typed */
227
- private [ this ] var evalState : SimpleIdentityMap [untpd.Tree , (TyperState , Constraint )] = SimpleIdentityMap .Empty
227
+ private var evalState : SimpleIdentityMap [untpd.Tree , (TyperState , Constraint )] = SimpleIdentityMap .Empty
228
228
229
229
def isMatchedBy (tp : Type )(implicit ctx : Context ) =
230
230
typer.isApplicable(tp, Nil , unforcedTypedArgs, resultType)
@@ -308,7 +308,7 @@ object ProtoTypes {
308
308
def typeOfArg (arg : untpd.Tree )(implicit ctx : Context ): Type =
309
309
myTypedArg(arg).tpe
310
310
311
- private [ this ] var myTupled : Type = NoType
311
+ private var myTupled : Type = NoType
312
312
313
313
/** The same proto-type but with all arguments combined in a single tuple */
314
314
def tupled : FunProto = myTupled match {
@@ -323,7 +323,7 @@ object ProtoTypes {
323
323
def isTupled : Boolean = myTupled.isInstanceOf [FunProto ]
324
324
325
325
/** If true, the application of this prototype was canceled. */
326
- private [ this ] var toDrop : Boolean = false
326
+ private var toDrop : Boolean = false
327
327
328
328
/** Cancel the application of this prototype. This can happen for a nullary
329
329
* application `f()` if `f` refers to a symbol that exists both in parameterless
@@ -347,6 +347,18 @@ object ProtoTypes {
347
347
ta(ta.foldOver(x, typedArgs.tpes), resultType)
348
348
349
349
override def deepenProto (implicit ctx : Context ) = derivedFunProto(args, resultType.deepenProto, typer)
350
+
351
+ override def withContext (newCtx : Context ) =
352
+ if (newCtx `eq` ctx) this
353
+ else {
354
+ val result = new FunProto (args, resType, typer)(newCtx)
355
+ result.myTypedArgs = myTypedArgs
356
+ result.myTypedArg = myTypedArg
357
+ result.evalState = evalState
358
+ result.myTupled = myTupled
359
+ result.toDrop = toDrop
360
+ result
361
+ }
350
362
}
351
363
352
364
@@ -356,6 +368,7 @@ object ProtoTypes {
356
368
*/
357
369
class FunProtoTyped (args : List [tpd.Tree ], resultType : Type , typer : Typer )(implicit ctx : Context ) extends FunProto (args, resultType, typer)(ctx) {
358
370
override def typedArgs = args
371
+ override def withContext (ctx : Context ) = this
359
372
}
360
373
361
374
/** A prototype for implicitly inferred views:
0 commit comments