File tree Expand file tree Collapse file tree 3 files changed +5
-12
lines changed
src/compiler/scala/tools/nsc Expand file tree Collapse file tree 3 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,8 @@ trait ScalaSettings extends AbsScalaSettings
83
83
* The previous "-source" option is intended to be used mainly
84
84
* though this helper.
85
85
*/
86
- def isScala211 : Boolean = source.value >= ScalaVersion (" 2.11.0" )
86
+ private [this ] val version211 = ScalaVersion (" 2.11.0" )
87
+ def isScala211 : Boolean = source.value >= version211
87
88
private [this ] val version212 = ScalaVersion (" 2.12.0" )
88
89
def isScala212 : Boolean = source.value >= version212
89
90
private [this ] val version213 = ScalaVersion (" 2.13.0" )
Original file line number Diff line number Diff line change @@ -1424,9 +1424,9 @@ trait Implicits {
1424
1424
val outSym = out.typeSymbol
1425
1425
1426
1426
val fail =
1427
- if (out.annotations.isEmpty && (outSym == ObjectClass || (isScala211 && outSym == AnyValClass )))
1427
+ if (out.annotations.isEmpty && (outSym == ObjectClass || (settings. isScala211 && outSym == AnyValClass )))
1428
1428
maybeInvalidConversionError(s " the result type of an implicit conversion must be more specific than $out" )
1429
- else if (isScala211 && in.annotations.isEmpty && in.typeSymbol == NullClass )
1429
+ else if (settings. isScala211 && in.annotations.isEmpty && in.typeSymbol == NullClass )
1430
1430
maybeInvalidConversionError(" an expression of type Null is ineligible for implicit conversion" )
1431
1431
else false
1432
1432
@@ -1442,9 +1442,6 @@ trait Implicits {
1442
1442
result
1443
1443
}
1444
1444
1445
- // this setting is expensive to check, actually....
1446
- private [this ] val isScala211 = settings.isScala211
1447
-
1448
1445
def allImplicits : List [SearchResult ] = {
1449
1446
def search (iss : Infoss , isLocalToCallsite : Boolean ) = applicableInfos(iss, isLocalToCallsite).values
1450
1447
(
Original file line number Diff line number Diff line change @@ -58,11 +58,6 @@ trait Namers extends MethodSynthesis {
58
58
private lazy val innerNamer =
59
59
if (isTemplateContext(context)) createInnerNamer() else this
60
60
61
- // Cached as a val because `settings.isScala212` parses the Scala version each time...
62
- // Not in Namers because then we need to go to outer first to check this.
63
- // I do think it's ok to check every time we create a Namer instance (so, not a lazy val).
64
- private [this ] val isScala212 = settings.isScala212
65
-
66
61
def createNamer (tree : Tree ): Namer = {
67
62
val sym = tree match {
68
63
case ModuleDef (_, _, _) => tree.symbol.moduleClass
@@ -1586,7 +1581,7 @@ trait Namers extends MethodSynthesis {
1586
1581
val valOwner = owner.owner
1587
1582
// there's no overriding outside of classes, and we didn't use to do this in 2.11, so provide opt-out
1588
1583
1589
- if (! isScala212 || ! valOwner.isClass) WildcardType
1584
+ if (! settings. isScala212 || ! valOwner.isClass) WildcardType
1590
1585
else {
1591
1586
// normalize to getter so that we correctly consider a val overriding a def
1592
1587
// (a val's name ends in a " ", so can't compare to def)
You can’t perform that action at this time.
0 commit comments