-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-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.
Description
Consider:
// submit
void main(List<String> args) {
A().a; // not found
}
class A {
set a(int value) {}
}
extension on A {
int get a => 0;
}The .a access is not found even though there is an extension on A that defines it. I'm not sure if this is intended or not considering A defines a setter?
Concrete example, where fixing this bug would be useful:
// Assuming flutter:
abstract interface class ValueListenable<T> {
T get value;
void addListener(void Function() listener);
void removeListener(void Function() listener);
}
// package:library
abstract interface class MyController {
ValueListenable<MyState> get state;
set a(int a);
}
class MyState {
final int a;
const MyState({
required this.a,
});
}
// my_app
void main() {
final controller = MyController();
print(controller.a); // Accessing the value of 'a' from `MyState` via getter
}
extension on MyController {
int get a => state.value.a;
}dart --version
Dart SDK version: 3.7.2 (stable) (Tue Mar 11 04:27:50 2025 -0700) on "macos_arm64"
Metadata
Metadata
Assignees
Labels
area-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.