Skip to content

using dot notation for operator fails if operator defined in trait is in scope #8391

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

Closed
robstoll opened this issue Feb 27, 2020 · 0 comments · Fixed by #8400
Closed

using dot notation for operator fails if operator defined in trait is in scope #8391

robstoll opened this issue Feb 27, 2020 · 0 comments · Fixed by #8400
Assignees

Comments

@robstoll
Copy link
Contributor

robstoll commented Feb 27, 2020

minimized code

import scala.annotation.infix
import scala.annotation.alpha

trait MultiSet[T] {
  @alpha("intersection")
  def *(other: MultiSet[T]): MultiSet[T]
}

def test() = {
    val s1, s2: MultiSet[Int] = ???
    // comment out and the last statement fails with @alpha annotation "intersection" clashes with other definition is same scope
    //s1 * s2        
    //s1 * s2
    s1.*(s2)       
}

see for more details https://scastie.scala-lang.org/rnMia7lzSY2V9iLOya0w0Q

Note that it also happens if there is a top-level operator defined where the operator defined in the trait does not even need to be used (enough if it is in scope I guess)
see https://scastie.scala-lang.org/m40Jbs3nRMm3Dgb4RYRqcQ for more details.

Compilation output

@alpha annotation "foo" clashes with other definition is same scope

expectation

Should work

anatoliykmetyuk added a commit to dotty-staging/dotty that referenced this issue Feb 28, 2020
@anatoliykmetyuk anatoliykmetyuk self-assigned this Feb 28, 2020
odersky added a commit that referenced this issue Mar 1, 2020
Fix #8391: Track locally defined @Alpha aliases only for definitions
robstoll pushed a commit to tegonal/dotty that referenced this issue Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants