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
eernstg opened this issue
Jan 27, 2022
· 3 comments
Labels
area-metaCross-cutting, high-level issues (for tracking many other implementation issues, ...).type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
The program uses --enable-experiment=enhanced-enums. It does not have any errors, in particular, [] can be used as an actual argument because the spec has:
where args are considered as occurring in a const context, ...
However, the CFE reports an error at [] (two, actually):
n017.dart:2:7: Error: Constant expression expected.
Try inserting 'const'.
v([]);
^
n017.dart:2:7: Error: Non-constant list literal is not a constant expression.
v([]);
^
The analyzer rejects the program as follows:
ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER|/usr/local/google/home/eernst/lang/dart/scratch/202201/n017.dart|3|9|1|A constant constructor can't call a non-constant super constructor of 'Enum'.
which means that the analyzer may or may not have the same fault, but we don't get to see it because we encounter an error with the Enum constructor (which could be a fault in the analyzer, or in the declaration of Enum, or both).
So we have at least one platform where there is a need to make this change: An enum value declaration is a constant context.
The text was updated successfully, but these errors were encountered:
eernstg
added
area-meta
Cross-cutting, high-level issues (for tracking many other implementation issues, ...).
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
labels
Jan 27, 2022
@scheglov, do you agree that the CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER issue that seems to affect the analysis of every enhanced enum declaration could mask errors on the enum members? Is it expected to be resolved soon?
area-metaCross-cutting, high-level issues (for tracking many other implementation issues, ...).type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
Consider the following program:
The program uses
--enable-experiment=enhanced-enums
. It does not have any errors, in particular,[]
can be used as an actual argument because the spec has:However, the CFE reports an error at
[]
(two, actually):The analyzer rejects the program as follows:
which means that the analyzer may or may not have the same fault, but we don't get to see it because we encounter an error with the
Enum
constructor (which could be a fault in the analyzer, or in the declaration ofEnum
, or both).So we have at least one platform where there is a need to make this change: An enum value declaration is a constant context.
Subtasks:
The text was updated successfully, but these errors were encountered: