@@ -88,7 +88,7 @@ class Definitions {
88
88
newClassSymbol(ScalaPackageClass , name, EmptyFlags , completer).entered
89
89
}
90
90
91
- /** The trait FunctionN, ImplicitFunctionN, UnusedFunctionN or UnusedImplicitFunction , for some N
91
+ /** The trait FunctionN, ImplicitFunctionN, GhostFunctionN or GhostImplicitFunction , for some N
92
92
* @param name The name of the trait to be created
93
93
*
94
94
* FunctionN traits follow this template:
@@ -107,19 +107,19 @@ class Definitions {
107
107
* def apply(implicit $x0: T0, ..., $x{N_1}: T{N-1}): R
108
108
* }
109
109
*
110
- * UnusedFunctionN traits follow this template:
110
+ * GhostFunctionN traits follow this template:
111
111
*
112
- * trait UnusedFunctionN [T0,...,T{N-1}, R] extends Object {
113
- * def apply(unused $x0: T0, ..., $x{N_1}: T{N-1}): R
112
+ * trait GhostFunctionN [T0,...,T{N-1}, R] extends Object {
113
+ * def apply(ghost $x0: T0, ..., $x{N_1}: T{N-1}): R
114
114
* }
115
115
*
116
- * UnusedImplicitFunctionN traits follow this template:
116
+ * GhostImplicitFunctionN traits follow this template:
117
117
*
118
- * trait UnusedImplicitFunctionN [T0,...,T{N-1}, R] extends Object with UnusedFunctionN [T0,...,T{N-1}, R] {
119
- * def apply(unused implicit $x0: T0, ..., $x{N_1}: T{N-1}): R
118
+ * trait GhostImplicitFunctionN [T0,...,T{N-1}, R] extends Object with GhostFunctionN [T0,...,T{N-1}, R] {
119
+ * def apply(ghost implicit $x0: T0, ..., $x{N_1}: T{N-1}): R
120
120
* }
121
121
*
122
- * UnusedFunctionN and UnusedImplicitFunctionN erase to Function0.
122
+ * GhostFunctionN and GhostImplicitFunctionN erase to Function0.
123
123
*/
124
124
def newFunctionNTrait (name : TypeName ): ClassSymbol = {
125
125
val completer = new LazyType {
@@ -132,10 +132,10 @@ class Definitions {
132
132
enterTypeParam(cls, paramNamePrefix ++ " T" ++ (i + 1 ).toString, Contravariant , decls).typeRef
133
133
}
134
134
val resParamRef = enterTypeParam(cls, paramNamePrefix ++ " R" , Covariant , decls).typeRef
135
- val methodType = MethodType .maker(isJava = false , name.isImplicitFunction, name.isUnusedFunction )
135
+ val methodType = MethodType .maker(isJava = false , name.isImplicitFunction, name.isGhostFunction )
136
136
val parentTraits =
137
137
if (! name.isImplicitFunction) Nil
138
- else FunctionType (arity, isUnused = name.isUnusedFunction ).appliedTo(argParamRefs ::: resParamRef :: Nil ) :: Nil
138
+ else FunctionType (arity, isGhost = name.isGhostFunction ).appliedTo(argParamRefs ::: resParamRef :: Nil ) :: Nil
139
139
decls.enter(newMethod(cls, nme.apply, methodType(argParamRefs, resParamRef), Deferred ))
140
140
denot.info =
141
141
ClassInfo (ScalaPackageClass .thisType, cls, ObjectType :: parentTraits, decls)
@@ -756,14 +756,14 @@ class Definitions {
756
756
sym.owner.linkedClass.typeRef
757
757
758
758
object FunctionOf {
759
- def apply (args : List [Type ], resultType : Type , isImplicit : Boolean = false , isUnused : Boolean = false )(implicit ctx : Context ) =
760
- FunctionType (args.length, isImplicit, isUnused ).appliedTo(args ::: resultType :: Nil )
759
+ def apply (args : List [Type ], resultType : Type , isImplicit : Boolean = false , isGhost : Boolean = false )(implicit ctx : Context ) =
760
+ FunctionType (args.length, isImplicit, isGhost ).appliedTo(args ::: resultType :: Nil )
761
761
def unapply (ft : Type )(implicit ctx : Context ) = {
762
762
val tsym = ft.typeSymbol
763
763
if (isFunctionClass(tsym)) {
764
764
val targs = ft.dealias.argInfos
765
765
if (targs.isEmpty) None
766
- else Some (targs.init, targs.last, tsym.name.isImplicitFunction, tsym.name.isUnusedFunction )
766
+ else Some (targs.init, targs.last, tsym.name.isImplicitFunction, tsym.name.isGhostFunction )
767
767
}
768
768
else None
769
769
}
@@ -827,18 +827,18 @@ class Definitions {
827
827
828
828
lazy val TupleType = mkArityArray(" scala.Tuple" , MaxTupleArity , 2 )
829
829
830
- def FunctionClass (n : Int , isImplicit : Boolean = false , isUnused : Boolean = false )(implicit ctx : Context ) = {
831
- if (isImplicit && isUnused ) {
830
+ def FunctionClass (n : Int , isImplicit : Boolean = false , isGhost : Boolean = false )(implicit ctx : Context ) = {
831
+ if (isImplicit && isGhost ) {
832
832
require(n > 0 )
833
- ctx.requiredClass(" scala.UnusedImplicitFunction " + n.toString)
833
+ ctx.requiredClass(" scala.GhostImplicitFunction " + n.toString)
834
834
}
835
835
else if (isImplicit) {
836
836
require(n > 0 )
837
837
ctx.requiredClass(" scala.ImplicitFunction" + n.toString)
838
838
}
839
- else if (isUnused ) {
839
+ else if (isGhost ) {
840
840
require(n > 0 )
841
- ctx.requiredClass(" scala.UnusedFunction " + n.toString)
841
+ ctx.requiredClass(" scala.GhostFunction " + n.toString)
842
842
}
843
843
else if (n <= MaxImplementedFunctionArity ) FunctionClassPerRun ()(ctx)(n)
844
844
else ctx.requiredClass(" scala.Function" + n.toString)
@@ -847,9 +847,9 @@ class Definitions {
847
847
lazy val Function0_applyR = ImplementedFunctionType (0 ).symbol.requiredMethodRef(nme.apply)
848
848
def Function0_apply (implicit ctx : Context ) = Function0_applyR .symbol
849
849
850
- def FunctionType (n : Int , isImplicit : Boolean = false , isUnused : Boolean = false )(implicit ctx : Context ): TypeRef =
851
- if (n <= MaxImplementedFunctionArity && (! isImplicit || ctx.erasedTypes) && ! isUnused ) ImplementedFunctionType (n)
852
- else FunctionClass (n, isImplicit, isUnused ).typeRef
850
+ def FunctionType (n : Int , isImplicit : Boolean = false , isGhost : Boolean = false )(implicit ctx : Context ): TypeRef =
851
+ if (n <= MaxImplementedFunctionArity && (! isImplicit || ctx.erasedTypes) && ! isGhost ) ImplementedFunctionType (n)
852
+ else FunctionClass (n, isImplicit, isGhost ).typeRef
853
853
854
854
private lazy val TupleTypes : Set [TypeRef ] = TupleType .toSet
855
855
@@ -874,22 +874,22 @@ class Definitions {
874
874
/** Is a function class.
875
875
* - FunctionN for N >= 0
876
876
* - ImplicitFunctionN for N > 0
877
- * - UnusedFunctionN for N > 0
878
- * - UnusedImplicitFunctionN for N > 0
877
+ * - GhostFunctionN for N > 0
878
+ * - GhostImplicitFunctionN for N > 0
879
879
*/
880
880
def isFunctionClass (cls : Symbol ) = scalaClassName(cls).isFunction
881
881
882
882
/** Is an implicit function class.
883
883
* - ImplicitFunctionN for N > 0
884
- * - UnusedImplicitFunctionN for N > 0
884
+ * - GhostImplicitFunctionN for N > 0
885
885
*/
886
886
def isImplicitFunctionClass (cls : Symbol ) = scalaClassName(cls).isImplicitFunction
887
887
888
- /** Is an unused function class.
889
- * - UnusedFunctionN for N > 0
890
- * - UnusedImplicitFunctionN for N > 0
888
+ /** Is an ghost function class.
889
+ * - GhostFunctionN for N > 0
890
+ * - GhostImplicitFunctionN for N > 0
891
891
*/
892
- def isUnusedFunctionClass (cls : Symbol ) = scalaClassName(cls).isUnusedFunction
892
+ def isGhostFunctionClass (cls : Symbol ) = scalaClassName(cls).isGhostFunction
893
893
894
894
/** Is a class that will be erased to FunctionXXL
895
895
* - FunctionN for N >= 22
@@ -915,13 +915,13 @@ class Definitions {
915
915
* - FunctionN for 22 > N >= 0 remains as FunctionN
916
916
* - ImplicitFunctionN for N > 22 becomes FunctionXXL
917
917
* - ImplicitFunctionN for 22 > N >= 0 becomes FunctionN
918
- * - UnusedFunctionN becomes Function0
919
- * - ImplicitUnusedFunctionN becomes Function0
918
+ * - GhostFunctionN becomes Function0
919
+ * - ImplicitGhostFunctionN becomes Function0
920
920
* - anything else becomes a NoSymbol
921
921
*/
922
922
def erasedFunctionClass (cls : Symbol ): Symbol = {
923
923
val arity = scalaClassName(cls).functionArity
924
- if (cls.name.isUnusedFunction ) FunctionClass (0 )
924
+ if (cls.name.isGhostFunction ) FunctionClass (0 )
925
925
else if (arity > 22 ) FunctionXXLClass
926
926
else if (arity >= 0 ) FunctionClass (arity)
927
927
else NoSymbol
@@ -932,13 +932,13 @@ class Definitions {
932
932
* - FunctionN for 22 > N >= 0 remains as FunctionN
933
933
* - ImplicitFunctionN for N > 22 becomes FunctionXXL
934
934
* - ImplicitFunctionN for 22 > N >= 0 becomes FunctionN
935
- * - UnusedFunctionN becomes Function0
936
- * - ImplicitUnusedFunctionN becomes Function0
935
+ * - GhostFunctionN becomes Function0
936
+ * - ImplicitGhostFunctionN becomes Function0
937
937
* - anything else becomes a NoType
938
938
*/
939
939
def erasedFunctionType (cls : Symbol ): Type = {
940
940
val arity = scalaClassName(cls).functionArity
941
- if (cls.name.isUnusedFunction ) FunctionType (0 )
941
+ if (cls.name.isGhostFunction ) FunctionType (0 )
942
942
else if (arity > 22 ) FunctionXXLType
943
943
else if (arity >= 0 ) FunctionType (arity)
944
944
else NoType
@@ -1008,7 +1008,7 @@ class Definitions {
1008
1008
def isNonDepFunctionType (tp : Type )(implicit ctx : Context ) = {
1009
1009
val arity = functionArity(tp)
1010
1010
val sym = tp.dealias.typeSymbol
1011
- arity >= 0 && isFunctionClass(sym) && tp.isRef(FunctionType (arity, sym.name.isImplicitFunction, sym.name.isUnusedFunction ).typeSymbol)
1011
+ arity >= 0 && isFunctionClass(sym) && tp.isRef(FunctionType (arity, sym.name.isImplicitFunction, sym.name.isGhostFunction ).typeSymbol)
1012
1012
}
1013
1013
1014
1014
/** Is `tp` a representation of a (possibly depenent) function type or an alias of such? */
@@ -1074,8 +1074,8 @@ class Definitions {
1074
1074
def isImplicitFunctionType (tp : Type )(implicit ctx : Context ): Boolean =
1075
1075
asImplicitFunctionType(tp).exists
1076
1076
1077
- def isUnusedFunctionType (tp : Type )(implicit ctx : Context ) =
1078
- isFunctionType(tp) && tp.dealias.typeSymbol.name.isUnusedFunction
1077
+ def isGhostFunctionType (tp : Type )(implicit ctx : Context ) =
1078
+ isFunctionType(tp) && tp.dealias.typeSymbol.name.isGhostFunction
1079
1079
1080
1080
// ----- primitive value class machinery ------------------------------------------
1081
1081
0 commit comments