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

Introducing: the fields phase [ci: last-only] #5141

Merged
merged 17 commits into from Aug 11, 2016

Allow 'overriding' deferred var

Discovered by scala-js's test suite.
  • Loading branch information...
adriaanm committed Jul 6, 2016
commit 9b59f5f9530d54c917479c6bf44aa3007ba0a2df
@@ -433,7 +433,7 @@ abstract class RefChecks extends Transform {
} else if (other.isAbstractOverride && other.isIncompleteIn(clazz) && !member.isAbstractOverride) {
overrideError("needs `abstract override' modifiers")
}
else if (member.isAnyOverride && (other hasFlag ACCESSOR) && !(other hasFlag STABLE)) {
else if (member.isAnyOverride && (other hasFlag ACCESSOR) && !(other hasFlag STABLE | DEFERRED)) {
// The check above used to look at `field` == `other.accessed`, ensuring field.isVariable && !field.isLazy,
// which I think is identical to the more direct `!(other hasFlag STABLE)` (given that `other` is a method).
// Also, we're moving away from (looking at) underlying fields (vals in traits no longer have them, to begin with)
@@ -0,0 +1,5 @@
trait_fields_var_override.scala:2: error: overriding variable end in trait SizeChangeEvent of type Int;
variable end cannot override a mutable variable
class BackedUpListIterator[E](override protected var end: Int) extends SizeChangeEvent
^
one error found
@@ -0,0 +1,2 @@
trait SizeChangeEvent { protected var end: Int = 1 }
class BackedUpListIterator[E](override protected var end: Int) extends SizeChangeEvent
@@ -0,0 +1,2 @@
trait SizeChangeEvent { protected var end: Int }
class BackedUpListIterator[E](override protected var end: Int) extends SizeChangeEvent
ProTip! Use n and p to navigate between commits in a pull request.