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

F bounded quantification bug #25530

Closed
jmesserly opened this issue Jan 19, 2016 · 6 comments
Closed

F bounded quantification bug #25530

jmesserly opened this issue Jan 19, 2016 · 6 comments
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. 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

@jmesserly
Copy link

from @vsmenon, moved from dart-archive/dev_compiler#357

From f_bounded_quantification2_test.dart:

class Entities<T extends ConceptEntity<T>> implements EntitiesApi<T> { }

class ConceptEntity<T extends ConceptEntity<T>> implements EntityApi { }

abstract class EntityApi<T extends EntityApi<T>> { }

abstract class EntitiesApi<T extends EntityApi<T>> { }

class Concept extends ConceptEntity<Concept> { }

main() {
  new ConceptEntity<Concept>();
  new ConceptEntity<ConceptEntity>();
}

is triggering the following errors - newly in the task model strong mode:

severe: [AnalyzerMessage] 'T' does not extend 'EntityApi<T>' (test/codegen/language/f_bounded_quantification2_test.dart, line 7, col 67)
severe: [AnalyzerMessage] 'ConceptEntity' does not extend 'ConceptEntity<ConceptEntity>' (test/codegen/language/f_bounded_quantification2_test.dart, line 19, col 21)

This particular test isn't strictly blocking - we don't support this pattern yet in codegen, but it is a regression.

@Andersmholmgren
Copy link

I believe this is the issue I'm hitting now. I've spent the last day or so moving projects to strong mode, adding generic method parameters and getting rid of analyser warnings.

But when I go to run the unit tests pretty much everything blows up now like


  'package:frentity/src/model/entity/state.dart': malbounded type: line 12 pos 31: type parameter 'S' of class 'ComponentState' must extend bound 'ComponentState<S>', but type argument 'AddIssueSourceMember' is not a subtype of 'ComponentState<AddIssueSourceMember>'

  abstract class ComponentState<S extends ComponentState<S>> {
                                ^
  'package:gissue_client_models/src/client/model/repos/add_issue_source_list_editor.dart': malbounded type: line 181 pos 51: type 'AddIssueSourceMember' has an out of bound type argument
  class AddIssueSourceMember extends RepoListMember<AddIssueSourceMember> {
                                                    ^
  'file:///Users/blah/dart/backlogio_acdart/gitbacklog_root/gissue_root/gissue_client_models/test/client/model/repos/add_issue_source_list_editor_test.dart': malbounded type: line 30 pos 3: type 'AddIssueSourceListEditor' has an out of bound type argument
    AddIssueSourceListEditor editor;
    ^

Looking at the classes referenced here I believe the analyser is correct and the problem is at runtime.

class AddIssueSourceMember extends RepoListMember<AddIssueSourceMember> {}

class RepoListMember<M extends RepoListMember<M>>
    extends AbstractListMember<GitRepo, M> {}


abstract class AbstractListMember<E, M extends AbstractListMember<E, M>>
    extends ComponentState<M> {}

abstract class ComponentState<S extends ComponentState<S>> {}



class AddIssueSourceListEditor extends RepoListEditor<IssueSourceState,
    IssueSourceEntity, AddIssueSourceMember, AddIssueSourceListState> {
}

Any suggestions on a workaround? This is breaking things for me now

@vsmenon
Copy link
Member

vsmenon commented Jan 30, 2016

Do you have a self contained set of classes that exhibit the problem? What did the original code look like?

@Andersmholmgren
Copy link

I'll work on a repro. I might wait till #25568 is fixed on the odd chance that it is in some way related as it relates to similar classes

@munificent munificent mentioned this issue Feb 18, 2016
35 tasks
@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
@jmesserly
Copy link
Author

This version doesn't have any strong mode errors in the latest build:

class Entities<T extends ConceptEntity<T>> implements EntitiesApi<T> { }
class ConceptEntity<T extends ConceptEntity<T>> implements EntityApi<T> { }
abstract class EntityApi<T extends EntityApi<T>> { }
abstract class EntitiesApi<T extends EntityApi<T>> { }
class Concept extends ConceptEntity<Concept> { }

main() {
  new ConceptEntity<Concept>();
}

... so it may be possible to use this now.

@jmesserly
Copy link
Author

thanks to @zoechi for pointing this out :)

@jmesserly
Copy link
Author

this test is no longer marked failing.

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. 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

4 participants