Skip to content

with getter in superclass and setter in sublcass, warning: "Setter type 'T' must be assignable to getter type 'T'" #3067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DartBot opened this issue May 15, 2012 · 5 comments
Assignees

Comments

@DartBot
Copy link

DartBot commented May 15, 2012

This issue was originally filed by [email protected]


STEPS TO REPRODUCE
Code like this exhibits the problem:

interface Foo<T> {
// ...
T get val();
void set val(T value);
}

class Base<T> {
// ...
T get val() {
_validate();
return _value;
}
T _value;
bool _valid;
}

class Sub<T> extends Base<T> implements Foo<T> {
void set val(T value) {
_invalidate();
_value = value;
_valid = true;
}
// T get val() => super.val
}

EXPECTED OUTPUT? OBSERVED OUTPUT?
No warning is expected, but warning appears

PRODUCT VERSION? OPERATING SYSTEM?
Dart Editor build 7552 on OS X Lion.

ADDITIONAL INFORMATION.
Adding a getter in the subclass removes the warning (see the commented-out line in Sub<T> above).
Quoting Gilad: "Looks like a bug related to typechecking generics to me. "

@sethladd
Copy link
Contributor

I believe this is a VM issue, as the reporter is using the editor.


Added Area-VM, Triaged labels.

@iposva-google
Copy link
Contributor

Removed Area-VM label.
Added Area-Editor label.

@danrubel
Copy link

Set owner to @scheglov.

@scheglov
Copy link
Contributor

@scheglov
Copy link
Contributor

copybara-service bot pushed a commit that referenced this issue Jul 5, 2022
…4 revisions)

https://dart.googlesource.com/dartdoc/+log/900432d8cb1e..21f9341eb662

2022-07-05 [email protected] Switch to analyzer's updateAnalysisOptions2 (#3068)
2022-07-05 49699333+dependabot[bot]@users.noreply.github.com Bump ossf/scorecard-action from 1.1.1 to 1.1.2 (#3067)
2022-07-05 [email protected] bumped analyzer version to 4.0.0 (#3033)
2022-07-05 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.1.14 to 2.1.15 (#3066)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dart-doc-dart-sdk
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Dart Documentation Generator: https://github.com/dart-lang/dartdoc/issues
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Tbr: [email protected]
Change-Id: I6abe8e224af5682f96a7624e5b24a4921bf6c890
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250701
Commit-Queue: Kevin Moore <[email protected]>
Commit-Queue: DEPS Autoroller <[email protected]>
Reviewed-by: Kevin Moore <[email protected]>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants