Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine override exclude criterion for export forwarders #17590

Merged
merged 3 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1468,8 +1468,8 @@ object Parsers {
* PolyFunType ::= HKTypeParamClause '=>' Type
* | HKTypeParamClause ‘->’ [CaptureSet] Type -- under pureFunctions
* FunTypeArgs ::= InfixType
* | `(' [ [ ‘[using]’ ‘['erased'] FunArgType {`,' FunArgType } ] `)'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this somehow related to the actual change in the implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no I just piggy-backed another small fix.

* | '(' [ ‘[using]’ ‘['erased'] TypedFunParam {',' TypedFunParam } ')'
* | `(' [ [ ‘['erased'] FunArgType {`,' FunArgType } ] `)'
* | '(' [ ‘['erased'] TypedFunParam {',' TypedFunParam } ')'
*/
def typ(): Tree =
val start = in.offset
Expand Down
5 changes: 4 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,10 @@ class Namer { typer: Typer =>
No("is already an extension method, cannot be exported into another one")
else if targets.contains(alias) then
No(i"clashes with another export in the same export clause")
else if sym.is(Override) then
else if sym.is(Override) || sym.is(JavaDefined) then
// The tests above are used to avoid futile searches of `allOverriddenSymbols`.
// Scala defined symbols can override concrete symbols only if declared override.
// For Java defined symbols, this does not hold, so we have to search anyway.
sym.allOverriddenSymbols.find(
other => cls.derivesFrom(other.owner) && !other.is(Deferred)
) match
Expand Down
1 change: 1 addition & 0 deletions compiler/test/dotc/pos-test-pickling.blacklist
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ i15922.scala
t5031_2.scala
i16997.scala
i7414.scala
i17588.scala

# Tree is huge and blows stack for printing Text
i7034.scala
Expand Down
2 changes: 2 additions & 0 deletions tests/pos/i17588.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class StringBox(inner: String):
export inner.*