Analyzer does not consistently consider invocations on Never
to have type Never
.
#56985
Labels
analyzer-spec
Issues with the analyzer's implementation of the language spec
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P3
A lower priority bug or feature request
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
The NNBD spec says:
Assuming "operator" means "user-definable operator" (i.e. not
&&
,||
, or??
), then as far as I can tell, the CFE implements this faithfully.The analyzer is inconsistent, though:
expr1 operator expr2
, whereexpr1
has static typeNever
, has static typeNever
, as specified.expr(args)
, whereexpr
has static typeNever
, has static typeNever
, as specified.expr.identifier(args)
, whereexpr
has static typeNever
, has static typeNever
, as specified.identifier1.identifier2
, whereidentifier1
has static typeNever
, has static typeNever
, as specified.expr.identifier
, whereexpr
is an expression having static typeNever
, but is not a simple identifier, behaves as follows:identifier
ishashCode
,toString
,runtimeType
, ornoSuchMethod
, the type is the same as it would be if the receiver type wereObject
(e.g.(throw '').toString
has typeString Function()
).InvalidType
, but no error is issued.on
type isNever
,identifier
andidentifier(args)
are treated the same as they would be treated if theon
type wereObject
.The text was updated successfully, but these errors were encountered: