-
Couldn't load subscription status.
- Fork 1.7k
Open
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
The NNBD spec says:
Calling a method (including an operator) or getter on a receiver of static type
Neveris treated by static analysis as producing a result of typeNever. Tearing off a method from a receiver of static typeNeverproduces a value of typeNever. Applying an expression of typeNeverin the function position of a function call produces a result of typeNever.
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, whereexpr1has static typeNever, has static typeNever, as specified.expr(args), whereexprhas static typeNever, has static typeNever, as specified.expr.identifier(args), whereexprhas static typeNever, has static typeNever, as specified.identifier1.identifier2, whereidentifier1has static typeNever, has static typeNever, as specified.expr.identifier, whereexpris an expression having static typeNever, but is not a simple identifier, behaves as follows:- If
identifierishashCode,toString,runtimeType, ornoSuchMethod, the type is the same as it would be if the receiver type wereObject(e.g.(throw '').toStringhas typeString Function()). - Otherwise, the type is
InvalidType, but no error is issued.
- If
- In an extension whose
ontype isNever,identifierandidentifier(args)are treated the same as they would be treated if theontype wereObject.
FMorschel and srawlins
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)