Skip to content

Commit e5032e0

Browse files
authored
Backport "Refine override exclude criterion for export forwarders" to LTS (#18944)
Backports #17590 to the LTS branch. PR submitted by the release tooling.
2 parents 0833483 + cc33c46 commit e5032e0

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,8 +1468,8 @@ object Parsers {
14681468
* PolyFunType ::= HKTypeParamClause '=>' Type
14691469
* | HKTypeParamClause ‘->’ [CaptureSet] Type -- under pureFunctions
14701470
* FunTypeArgs ::= InfixType
1471-
* | `(' [ [ ‘[using]’ ‘['erased'] FunArgType {`,' FunArgType } ] `)'
1472-
* | '(' [ ‘[using]’ ‘['erased'] TypedFunParam {',' TypedFunParam } ')'
1471+
* | `(' [ [ ‘['erased'] FunArgType {`,' FunArgType } ] `)'
1472+
* | '(' [ ‘['erased'] TypedFunParam {',' TypedFunParam } ')'
14731473
*/
14741474
def typ(): Tree =
14751475
val start = in.offset

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,10 @@ class Namer { typer: Typer =>
11221122
No("is already an extension method, cannot be exported into another one")
11231123
else if targets.contains(alias) then
11241124
No(i"clashes with another export in the same export clause")
1125-
else if sym.is(Override) then
1125+
else if sym.is(Override) || sym.is(JavaDefined) then
1126+
// The tests above are used to avoid futile searches of `allOverriddenSymbols`.
1127+
// Scala defined symbols can override concrete symbols only if declared override.
1128+
// For Java defined symbols, this does not hold, so we have to search anyway.
11261129
sym.allOverriddenSymbols.find(
11271130
other => cls.derivesFrom(other.owner) && !other.is(Deferred)
11281131
) match

compiler/test/dotc/pos-test-pickling.blacklist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ i15922.scala
2222
t5031_2.scala
2323
i16997.scala
2424
i7414.scala
25+
i17588.scala
2526

2627
# Tree is huge and blows stack for printing Text
2728
i7034.scala

tests/pos/i17588.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class StringBox(inner: String):
2+
export inner.*

0 commit comments

Comments
 (0)