Skip to content

Commit b8c58b1

Browse files
committed
Demote the new ambiguity: nothing in 2.13.11, warn (not err) under Xsource:3
1 parent ca6b46f commit b8c58b1

File tree

7 files changed

+11
-9
lines changed

7 files changed

+11
-9
lines changed

src/compiler/scala/tools/nsc/typechecker/Contexts.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,16 +1377,17 @@ trait Contexts { self: Analyzer =>
13771377
sm"""|it is both defined in the enclosing ${outer1.owner} and inherited in the enclosing $classDesc as $inherited1 (defined in ${inherited1.ownsString}$inherit)
13781378
|In Scala 2, symbols inherited from a superclass shadow symbols defined in an outer scope.
13791379
|Such references are ambiguous in Scala 3. To continue using the inherited symbol, write `this.${outer1.name}`."""
1380-
if (currentRun.isScala3)
1381-
Some(LookupAmbiguous(message))
1382-
else {
1380+
// For now (2.13.11), warn under Xsource:3. We'll consider warning by default (and erring in Xsource:3) in 2.13.12
1381+
if (currentRun.isScala3) {
13831382
// passing the message to `typedIdent` as attachment, we don't have the position here to report the warning
13841383
inherited.updateAttachment(LookupAmbiguityWarning(
13851384
sm"""|reference to ${outer1.name} is ambiguous;
13861385
|$message
13871386
|Or use `-Wconf:msg=legacy-binding:s` to silence this warning."""))
1387+
// Some(LookupAmbiguous(message)) // to make it an error in 2.13.12
1388+
None
1389+
} else
13881390
None
1389-
}
13901391
}
13911392
} else
13921393
Some(LookupAmbiguous(s"it is both defined in ${outer.owner} and available as ${inherited.fullLocationString}"))

test/files/neg/t11921-alias.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// scalac: -Werror
1+
// scalac: -Werror -Xsource:3
22

33
object t1 {
44
class C[T] { type TT = T }

test/files/neg/t11921.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
// scalac: -Xsource:3
22

33
class C {
44
def lazyMap[A, B](coll: Iterable[A], f: A => B) =

test/files/neg/t11921b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// scalac: -Werror
1+
// scalac: -Werror -Xsource:3
22

33
object test1 {
44

test/files/neg/t11921c.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// scalac: -Wconf:msg=legacy-binding:s
1+
// scalac: -Wconf:msg=legacy-binding:s -Xsource:3
22

33
class C {
44
def lazyMap[A, B](coll: Iterable[A], f: A => B) =

test/files/pos/t11921b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// scalac: -Werror -Wconf:msg=legacy-binding:s
1+
// scalac: -Werror -Wconf:msg=legacy-binding:s -Xsource:3
22

33
object test1 {
44

test/files/pos/t11921c.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Xsource:3
12

23
// test/scaladoc/resources/t5784.scala
34

0 commit comments

Comments
 (0)