Closed iarkh closed 4 years ago
/cc @johnniwinther
I suspect that the sentence 'The type Never
is treated as the type Null
' may have been written at a point in time where the legacy library was not expected to be able to refer to the type Never
. I believe that there is no need to have this sentence, and it actually creates some problems as shown here, and I've suggested in https://github.com/dart-lang/language/issues/825 that we delete this sentence from the nnbd spec.
The implementations behave correctly on this now - they report an error in strong mode and accept the code in weak mode.
Dart VM version: 2.8.0-edge.40f23c735f04433e4fc334fbd674474bd3de0f8b (Tue Jan 28 01:14:48 2020 +0000) on "linux_x64"
This issue is related with the issues #39917, #40387 somehow.
Please let me know if this is a bug in the NNBD Spec, in this case I will file a new issue against the Spec.
Dart NNBD Spec reads:
Particularly, this means that type
Never
should be treated as typeNull
when legacy code overrides opted in code.However, this is not so. For example, try the following:
Both dart and analyzer throw compile errors here. Sample output is: