Skip to content

Strange error when exporting overloaded stuff from the collection library #14966

Closed
@bjornregnell

Description

@bjornregnell

Compiler version

$ scala-cli repl . -S 3.nightly
Welcome to Scala 3.2.0-RC1-bin-20220415-8037f3b-NIGHTLY-git-8037f3b (11.0.11, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

Minimized code and Output

scala> class B(val s: Set[Int]):
     |   export s.*
     | 
-- [E120] Naming Error: --------------------------------------------------------
2 |  export s.*
  |           ^
  |Double definition:
  |final def concat
  |  (suffix: scala.collection.IterableOnce): scala.collection.immutable.Set in class B at line 2 and
  |final def concat
  |  (that: scala.collection.IterableOnce): scala.collection.immutable.Set 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.
1 error found

However if the concat methods are excluded then it works:

scala> class C(val s: Set[Int]):
     |   export s.{concat => _, ++ => _, *}
     | 
// defined class C

Expectation

Exporting all the Set stuff should work even with the concat methods.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions