You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spec section 10.16 has changed its handling of static setters (assignment)
If there is no class C in the enclosing lexical scope of the assignment, or if C does not declare, implicitly or explicitly, a setter v, then a NoSuchMethodError is thrown. Otherwise, the expression e is evaluated to an object o. Then, the setter C.v is invoked with its formal parameter bound to o. The value of the assignment expression is o.
It is a static warning if there is no class C in the enclosing lexical scope of the assignment, or if C does not declare, implicitly or explicitly, a setter v.
So, what was once a compile-time error is now a warning. Consequently, the situation where the warning arises need sto be handled dynamically via a NoSuchMethodError.
The text was updated successfully, but these errors were encountered:
However, the test still fails, but that's because of an inconsistency
which we can revisit later. The comment describes it best.
This is the stack trace of the failure:
AnalysisException: Element mismatch in /test.dart at class B
Caused by Bad state: Expected an element matching ``, got `x`
\#0 DeclarationResolver._match (package:analyzer/src/generated/declaration_resolver.dart:585:7)
\#1 DeclarationResolver.visitVariableDeclaration (package:analyzer/src/generated/declaration_resolver.dart:520:31)
\#2 VariableDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:11058:49)
\#3 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7987:20)
\#4 DeclarationResolver.visitVariableDeclarationList (package:analyzer/src/generated/declaration_resolver.dart:543:22)
\#5 VariableDeclarationListImpl.accept (package:analyzer/src/dart/ast/ast.dart:11154:15)
\#6 FieldDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:4372:17)
\#7 RecursiveAstVisitor.visitFieldDeclaration (package:analyzer/dart/ast/visitor.dart:827:10)
\#8 DeclarationResolver.visitFieldDeclaration (package:analyzer/src/generated/declaration_resolver.dart:226:32)
\#9 FieldDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:4367:49)
\#10 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7987:20)
Bug:
Change-Id: Ia0d8536e2f259c9e9c0b46366794e07796750467
Reviewed-on: https://dart-review.googlesource.com/26465
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Spec section 10.16 has changed its handling of static setters (assignment)
If there is no class C in the enclosing lexical scope of the assignment, or if C does not declare, implicitly or explicitly, a setter v, then a NoSuchMethodError is thrown. Otherwise, the expression e is evaluated to an object o. Then, the setter C.v is invoked with its formal parameter bound to o. The value of the assignment expression is o.
It is a static warning if there is no class C in the enclosing lexical scope of the assignment, or if C does not declare, implicitly or explicitly, a setter v.
So, what was once a compile-time error is now a warning. Consequently, the situation where the warning arises need sto be handled dynamically via a NoSuchMethodError.
The text was updated successfully, but these errors were encountered: