Skip to content

Hande clashes between same-named exports #14967

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

Merged
merged 5 commits into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
10 changes: 6 additions & 4 deletions compiler/src/dotty/tools/dotc/reporting/messages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2174,10 +2174,12 @@ import transform.SymUtils._
else
"Name clash between inherited members"

em"""$clashDescription:
|${previousDecl.showDcl} ${symLocation(previousDecl)} and
|${decl.showDcl} ${symLocation(decl)}
|""" + details
atPhase(typerPhase) {
em"""$clashDescription:
|${previousDecl.showDcl} ${symLocation(previousDecl)} and
|${decl.showDcl} ${symLocation(decl)}
|"""
} + details
}
def explain = ""
}
Expand Down
10 changes: 10 additions & 0 deletions tests/neg/i14966.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- [E120] Naming Error: tests/neg/i14966.scala:2:11 --------------------------------------------------------------------
2 | export s.* // error
| ^
| Double definition:
| final def ++[B >: T](suffix: IterableOnce[B]): Set[B] in class B at line 2 and
| final def ++(that: IterableOnce[T]): Set[T] in class B at line 2
| have the same type after erasure.
|
| Consider adding a @targetName annotation to one of the conflicting definitions
| for disambiguation.
2 changes: 2 additions & 0 deletions tests/neg/i14966.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class B[T](val s: Set[T]):
export s.* // error