-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
dart-model-analyzer-specIssues with the analyzer's implementation of the language specIssues with the analyzer's implementation of the language speclegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.
Description
The analyzer reports an error on the assignments to topLevelMethod and topLevelMethod2 in the code below. This seems incorrect by my reading of the specification:
Evaluation of an assignment $a$ of the form \code{$v$ = $e$}
proceeds as follows:
%% TODO(eernst): $d$ is defined ambiguously: both getter & setter may exist.
Let $d$ be the innermost declaration whose name is $v$ or \code{$v$=}, if it exists.
It is a compile-time error if $d$ denotes
a prefix object, type declaration, or function declaration.
There is a clear innermost declaration whose name is topLevelMethod= (topLevelMethod2=) here, unless there is something non-obvious about the terminology here. The CFE issues no error on this code.
int get topLevelGetter => -1;
void set topLevelSetter(int _) {}
int topLevelField = -3;
int topLevelMethod(int x) => -4;
int topLevelMethod2(int x) => -4;
int _storeTo;
class E2 {
void set topLevelGetter(int x) { _storeTo = x; }
void set topLevelField(int x) { _storeTo = x; }
void set topLevelMethod(int x) { _storeTo = x; }
static void set topLevelMethod2(int x) { _storeTo = x; }
void test() {
topLevelGetter = 42;
topLevelField = 42;
topLevelMethod = 42;
topLevelMethod2 = 42;
}
}Metadata
Metadata
Assignees
Labels
dart-model-analyzer-specIssues with the analyzer's implementation of the language specIssues with the analyzer's implementation of the language speclegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.