Closed matanlurey closed 10 months ago
Not sure I understand the example.
The const
declarations are not valid (have to be static, there are no instance constant variables), you can't access statics of an extension through the on
type, and you can't access instance getters on a type object.
If they are supposed to be static, I don't think the priority has anything to do with the type Never
. But I can be wrong about that.
you can't access statics of an extension through
Sure you can:
void main() {
print(Presidents.abe);
}
extension Presidents on Never {
static const abe = 'Abraham';
static const george = 'George';
static const jefferson = 'Jefferson';
}
That's not "through the on
type". That's just accessing statics on the extension name directly, so it's not on Never
, and should (I hope) not be related to the Never
type at all.
I'd expect that it is the same for any extension type, that statics on an extension type hey lower priority than instance methods on the Type
object, possibly because extension instance methods get lower precedence than interface instance methods.
(But that is just guessing, until I get to test it.)
Simple example
On most types (i.e.
String
):but for
Never
:Why file this issue?
Good question. One could say this is such a rare or even unusable concept and the priority of this should be P12. However, this makes using a cute-little namespace pattern in Dart a bit ugly: