Skip to content
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

Analyzer does not handle aliases of @proxy #15467

Closed
johnniwinther opened this issue Dec 5, 2013 · 7 comments
Closed

Analyzer does not handle aliases of @proxy #15467

johnniwinther opened this issue Dec 5, 2013 · 7 comments
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. closed-obsolete Closed as the reported issue is no longer relevant P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@johnniwinther
Copy link
Member

Analyzer does not handle aliases of @­proxy, like

const alias = proxy;

@alias
class AliasProxy {}

Failing language tests:
language/proxy_test/05
language/proxy_test/06

@bwilkerson
Copy link
Member

Nor is it clear that it ought to. According to the specification:

  Let C be a concrete class that does not declare its own noSuchMethod() method and is
  not annotated with a metadata declaration of the form @­proxy where proxy is declared
  in dart:core.

  It is a static warning if the implicit interface of C includes an instance member m of type
  F and C does not declare or inherit a corresponding instance member m of type F’ such
  that F’ <: F.

The question is, does "of the form" mean that it has to be the same identifier, or does it mean "evaluates to the same value as". The analyzer does not execute Dart code. This is a special case that it could handle because, as far as I can think, this simple form of aliasing is the only kind of evaluation that would need to be done, but I'd rather not be required to perform even that much execution.

I'm changing this to a Language issue until this question is resolved. If we need to cover this case, please set it back to being an Analyzer issue.


Removed Area-Analyzer label.
Added Area-Language label.

@lrhn
Copy link
Member

lrhn commented Dec 6, 2013

I think it should work.
Metadata are constants values, and they should be treated as values. Looking at them syntactically is never the right thing to do.

It should be possible to do:

  class Foo extends Deprecated {
    final String author;
    const Foo(this.author, String until): super(until);
  }

and then do:
  @­Foo("Me", "Forever!")
  int fisk = 42;

and have the "fisk" variable be deprecated - because it is annotated by a value that implements Deprecated.

That might require tracking constant values, not names.

@lrhn
Copy link
Member

lrhn commented Dec 6, 2013

I've been meaning to add tests for this for a while, so good job Johnni :)

@gbracha
Copy link
Contributor

gbracha commented Aug 29, 2014

The spec says:

" ... a constant identical to the constant @­proxy defined in dart:core. "

so I'm sending this bug to analyzer land.


Set owner to @gbracha.
Removed Area-Language label.
Added Area-Analyzer, Area-dart2js, Accepted labels.

@bwilkerson
Copy link
Member

Removed the owner.
Removed Priority-Unassigned, Area-dart2js labels.
Added Priority-Medium label.

@stereotype441
Copy link
Member

Set owner to @stereotype441.
Added Started label.

@johnniwinther johnniwinther added Type-Defect area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Sep 24, 2014
@stereotype441
Copy link
Member

I did some preliminary work on this ages ago. The plan was to:

  1. Don't report warnings that can be suppressed by @proxy in the resolver; instead, store enough information in the AST that the errors can be reported later by the ErrorVerifier.
  2. Use constant evaluation to determine the values of annotations.
  3. In the ErrorVerifier, make use of the constant evaluation results to determine whether a class is annotated with @proxy, and use that to decide whether to issue the warning or not.

I believe steps 1 and 2 have been completed.

@stereotype441 stereotype441 removed their assignment Feb 3, 2016
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed Priority-Medium labels Mar 1, 2016
@matanlurey matanlurey added the closed-obsolete Closed as the reported issue is no longer relevant label Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. closed-obsolete Closed as the reported issue is no longer relevant P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

7 participants