@@ -145,11 +145,20 @@ class Definitions {
145
145
}
146
146
147
147
private def enterPolyMethod (cls : ClassSymbol , name : TermName , typeParamCount : Int ,
148
- resultTypeFn : PolyType => Type , flags : FlagSet = EmptyFlags ) = {
148
+ resultTypeFn : PolyType => Type , flags : FlagSet = EmptyFlags ,
149
+ useCompleter : Boolean = false ) = {
149
150
val tparamNames = PolyType .syntheticParamNames(typeParamCount)
150
151
val tparamInfos = tparamNames map (_ => TypeBounds .empty)
151
- val ptype = PolyType (tparamNames)(_ => tparamInfos, resultTypeFn)
152
- enterMethod(cls, name, ptype, flags)
152
+ def ptype = PolyType (tparamNames)(_ => tparamInfos, resultTypeFn)
153
+ val info =
154
+ if (useCompleter)
155
+ new LazyType {
156
+ def complete (denot : SymDenotation )(implicit ctx : Context ): Unit = {
157
+ denot.info = ptype
158
+ }
159
+ }
160
+ else ptype
161
+ enterMethod(cls, name, info, flags)
153
162
}
154
163
155
164
private def enterT1ParameterlessMethod (cls : ClassSymbol , name : TermName , resultTypeFn : PolyType => Type , flags : FlagSet ) =
@@ -298,11 +307,13 @@ class Definitions {
298
307
299
308
/** Method representing a term quote */
300
309
lazy val quoteMethod = enterPolyMethod(OpsPackageClass , nme.QUOTE , 1 ,
301
- pt => MethodType (pt.paramRefs(0 ) :: Nil , QuotedExprType .appliedTo(pt.paramRefs(0 ) :: Nil )))
310
+ pt => MethodType (pt.paramRefs(0 ) :: Nil , QuotedExprType .appliedTo(pt.paramRefs(0 ) :: Nil )),
311
+ useCompleter = true )
302
312
303
313
/** Method representing a type quote */
304
314
lazy val typeQuoteMethod = enterPolyMethod(OpsPackageClass , nme.QUOTE , 1 ,
305
- pt => QuotedTypeType .appliedTo(pt.paramRefs(0 ) :: Nil ))
315
+ pt => QuotedTypeType .appliedTo(pt.paramRefs(0 ) :: Nil ),
316
+ useCompleter = true )
306
317
307
318
lazy val NothingClass : ClassSymbol = enterCompleteClassSymbol(
308
319
ScalaPackageClass , tpnme.Nothing , AbstractFinal , List (AnyClass .typeRef))
@@ -1093,9 +1104,7 @@ class Definitions {
1093
1104
1094
1105
/** Lists core methods that don't have underlying bytecode, but are synthesized on-the-fly in every reflection universe */
1095
1106
lazy val syntheticCoreMethods =
1096
- AnyMethods ++ ObjectMethods ++ List (String_+ , throwMethod
1097
- // , quoteMethod, typeQuoteMethod // we omit these because they force Expr and Type too early
1098
- )
1107
+ AnyMethods ++ ObjectMethods ++ List (String_+ , throwMethod, quoteMethod, typeQuoteMethod)
1099
1108
1100
1109
lazy val reservedScalaClassNames : Set [Name ] = syntheticScalaClasses.map(_.name).toSet
1101
1110
0 commit comments