Skip to content

Rare combination of mixing traits with annotated values causes an erroneous "inherits conflicting members" error in 2.10 #11190

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
DaniRey opened this issue Oct 3, 2018 · 2 comments
Milestone

Comments

@DaniRey
Copy link

DaniRey commented Oct 3, 2018

Mixing two traits, which contain a val annotated with @deprecated and using .stripMargin on the message (i.e. `@deprecated(message = "a".stripMargin, since = "a 1.0") in a separate compilation, causes an erroneous "inherits conflicting members" error in 2.10

sbt:DeprecatedValueBug> it:compile 
[info] Updating ... 
[info] Done updating. 
[info] Compiling 2 Scala sources to ....\DeprecatedValueBug\target\scala-2.10\classes ... 
[info] Done compiling. 
[info] Compiling 1 Scala source to ....\DeprecatedValueBug\target\scala-2.10\it-classes ... 
[error] .....\DeprecatedValueBug\src\it\scala\Use.scala:1:7: class Use inherits conflicting members: [error] value x in trait A of type String and 
[error] value x in trait B of type String 
[error] (Note: this can be resolved by declaring an override in class Use.) 
[error] class Use extends A with B { [error] ^ 
[error] one error found 
[error] (IntegrationTest / compileIncremental) Compilation failed 
[error] Total time: 1 s, completed 01.10.2018 23:11:52

Neither of the traits contains value x.

trait A {
  @deprecated(
    """
      |a
    """.stripMargin, "DepecatedValueBug")
  val a: String = "a"
}
trait B {
  @deprecated(
    """
      |b
      |"""".stripMargin, "DepecatedValueBug")
  val b: String = "b"
}
class Use extends A with B {

}

The error only occurs in Scala 2.10. https://github.com/DaniRey/DeprecatedValueBug contains the code needed to reproduce the issue.

@SethTisue SethTisue changed the title Rare combination of mixing traits with annotaed values causes an erroneous "inherits conflicting members" error in 2.10 Rare combination of mixing traits with annotated values causes an erroneous "inherits conflicting members" error in 2.10 Oct 8, 2018
@SethTisue SethTisue added this to the 2.11.0 milestone Oct 9, 2018
@SethTisue
Copy link
Member

thanks Dani! since this bug is 2.10-only, I'm closing it, but it's good to have the report here for future searchers to find. 2.10 will remain in use for some time yet to come.

@SethTisue
Copy link
Member

(not sure if related to #261)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants