-
Notifications
You must be signed in to change notification settings - Fork 1.7k
NNBD_TOP_MERGE results for Object? vs dynamic/void depends on the type order in class declaration #40541
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
It appears that NNBD_TOP_MERGE works as expected for the given two types. It is already covered in the unit tests for NNBD_TOP_MERGE:
Object? vs dynamic and dynamic vs Object? are checked and the result is Object? in both cases. Similarly for Object? vs void and void vs Object? , only the result for that is void in both cases.
It seems that the observed behavior here is due to the run-time semantics of |
The previous comment is correct. NNBD_TOP_MERGE does not modify how methods are looked up and does not modify the value of type parameters, at least not until dart-lang/language#841 is adopted (but it would not apply to this example). |
Since the consensus is that mitigation proposed in dart-lang/language#841 will not be implemented, this issue becomes invalid and there is nothing to fix in the VM. |
Just to clarify: The point here is that It is also true that both So if a test is supposed to determine what |
Dart VM version: 2.8.0-edge.aadcb4418b1a7ccbb74a7cc925ad55020ce4a924 (Thu Feb 6 02:00:49 2020 +0000) on "linux_x64"
NNBD Spec reads:
Please run the following source code example:
Dart prints:
Seems like both
D1().test();
andD2().test();
should printObject
here.The same is true for
NNBD_TOP_MERGE(Object?, void)
.The text was updated successfully, but these errors were encountered: