Navigation Menu

Skip to content

Commit

Permalink
Implicit vars should have non-implicit setters.
Browse files Browse the repository at this point in the history
Otherwise they trigger spurious feature warnings.

    scala> trait T { implicit var a: Any }
    <console>:7: warning: implicit conversion method a_= should
    be enabled by making the implicit value
    language.implicitConversions visible.
  • Loading branch information
retronym committed Dec 19, 2012
1 parent 14b8045 commit b53c35c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/reflect/scala/reflect/internal/Flags.scala
Expand Up @@ -262,7 +262,7 @@ class Flags extends ModifierFlags {
* Getters of immutable values also get STABLE.
*/
final val GetterFlags = ~(PRESUPER | MUTABLE)
final val SetterFlags = ~(PRESUPER | MUTABLE | STABLE | CASEACCESSOR)
final val SetterFlags = ~(PRESUPER | MUTABLE | STABLE | CASEACCESSOR | IMPLICIT)

/** When a symbol for a default getter is created, it inherits these
* flags from the method with the default. Other flags applied at creation
Expand Down
1 change: 1 addition & 0 deletions test/files/pos/setter-not-implicit.flags
@@ -0,0 +1 @@
-feature -Xfatal-warnings
3 changes: 3 additions & 0 deletions test/files/pos/setter-not-implicit.scala
@@ -0,0 +1,3 @@
object O {
implicit var x: Int = 0
}

0 comments on commit b53c35c

Please sign in to comment.