@@ -115,10 +115,9 @@ trait TypesSupport:
115
115
++ keyword(" & " ).l
116
116
++ inParens(inner(right), shouldWrapInParens(right, tp, false ))
117
117
case ByNameType (CapturingType (tpe, refs)) =>
118
- renderCaptureArrow (using qctx)(refs, false ) ++ (plain(" " ) :: inner(tpe))
118
+ renderFunctionArrow (using qctx)(refs, true , false ) ++ (plain(" " ) :: inner(tpe))
119
119
case ByNameType (tpe) =>
120
- tpe.typeSymbol.pos.map(p => report.warning(s " Pure ByNameType at ${p}" ))
121
- keyword(" -> " ) :: inner(tpe) // FIXME need to check if cc is enabled in current file first!!!
120
+ (if ccEnabled then keyword(" -> " ) else keyword(" => " )):: inner(tpe)
122
121
case ConstantType (constant) =>
123
122
plain(constant.show).l
124
123
case ThisType (tpe) =>
@@ -248,7 +247,8 @@ trait TypesSupport:
248
247
++ plain(" " ).l
249
248
++ inParens(inner(rhs), shouldWrapInParens(rhs, t, false ))
250
249
251
- case t @ AppliedType (tpe, args) if t.isFunctionType => functionType(t, tpe, args)
250
+ case t @ AppliedType (tpe, args) if t.isFunctionType =>
251
+ functionType(t, tpe, args)
252
252
253
253
case t @ AppliedType (tpe, typeList) =>
254
254
inner(tpe) ++ plain(" [" ).l ++ commas(typeList.map { t => t match
@@ -346,7 +346,7 @@ trait TypesSupport:
346
346
Some (List (CaptureDefs .captureRoot.termRef))
347
347
else
348
348
inCC
349
- val arrow = plain(" " ) :: (renderCaptureArrow (using qctx)(refs, t.isContextFunctionType) ++ plain(" " ).l)
349
+ val arrow = plain(" " ) :: (renderFunctionArrow (using qctx)(refs, t.isFunction1 , t.isContextFunctionType) ++ plain(" " ).l)
350
350
given Option [List [TypeRepr ]] = None // FIXME: this is ugly
351
351
args match
352
352
case Nil => Nil
@@ -485,17 +485,23 @@ trait TypesSupport:
485
485
import reflect ._
486
486
Keyword (" ^" ) :: renderCaptureSet(refs)
487
487
488
- private def renderCaptureArrow (using Quotes )(refs : List [reflect.TypeRepr ], isImplicitFun : Boolean )(using elideThis : reflect.ClassDef ): SSignature =
488
+ private def renderFunctionArrow (using Quotes )(refs : List [reflect.TypeRepr ], isPureFun : Boolean , isImplicitFun : Boolean )(using elideThis : reflect.ClassDef ): SSignature =
489
489
import reflect ._
490
490
val prefix = if isImplicitFun then " ?" else " "
491
- refs match
492
- case Nil => List (Keyword (prefix + " ->" )) // FIXME need to check if cc is enabled in current file first!!!
493
- case List (ref) if ref.isCaptureRoot => List (Keyword (prefix + " =>" ))
494
- case refs => Keyword (prefix + " ->" ) :: renderCaptureSet(refs)
491
+ if ! ccEnabled then
492
+ List (Keyword (prefix + " =>" ))
493
+ else
494
+ refs match
495
+ case Nil => if isPureFun then List (Keyword (prefix + " ->" )) else List (Keyword (prefix + " =>" ))
496
+ case List (ref) if ref.isCaptureRoot => List (Keyword (prefix + " =>" ))
497
+ case refs => Keyword (prefix + " ->" ) :: renderCaptureSet(refs)
495
498
496
- private def renderCaptureArrow (using qctx : Quotes )(refs : Option [List [reflect.TypeRepr ]], isImplicitFun : Boolean )(using elideThis : reflect.ClassDef ): SSignature =
499
+ private def renderFunctionArrow (using qctx : Quotes )(refs : Option [List [reflect.TypeRepr ]], isPureFun : Boolean , isImplicitFun : Boolean )(using elideThis : reflect.ClassDef ): SSignature =
497
500
import reflect ._
498
501
val prefix = if isImplicitFun then " ?" else " "
499
- refs match
500
- case None => List (Keyword (prefix + " ->" )) // FIXME need to check if cc is enabled in current file first!!!
501
- case Some (refs) => renderCaptureArrow(using qctx)(refs, isImplicitFun)
502
+ if ! ccEnabled then
503
+ List (Keyword (prefix + " =>" ))
504
+ else
505
+ refs match
506
+ case None => if isPureFun then List (Keyword (prefix + " ->" )) else List (Keyword (prefix + " =>" ))
507
+ case Some (refs) => renderFunctionArrow(using qctx)(refs, isPureFun, isImplicitFun)
0 commit comments