Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

no analysis issues from dev-compiler, but lots of strong mode issues at runtime #411

Closed
devoncarew opened this issue Jan 16, 2016 · 8 comments

Comments

@devoncarew
Copy link
Contributor

When I run analyze my app with strong mode (via the dev_compiler binary), I don't see any issues. This checks the app and the transitive set of packages. I do see plenty of issues at runtime however - things like:

Ignoring cast fail from (ProgressEvent) -> void to EventListener
Ignoring cast fail from _Future<dynamic> to Future<Map<dynamic, dynamic>>
Ignoring cast fail from _Future<dynamic> to Future<Map<String, dynamic>>
Ignoring cast fail from _Future<dynamic> to Future<String>
Ignoring cast fail from JSObject<Array> to List<String>

These are from the dart: libraries I believe. When I run dev_compiler -s (to include the dart: libs in the analysis) I see ~800 strong mode issues.

@devoncarew
Copy link
Contributor Author

I'm not sure if the resolution is just to fix all the issues in the dart: libs, or to expose the ones that'll impact a particular app at runtime in the analysis report.

@jmesserly
Copy link
Contributor

yeah we have a couple of related issues, we need to fix the SDK (#103) and for those "ignoring cast fail" messages we need to implement generic methods in DDC (#301)

I'm not sure if the resolution is just to fix all the issues in the dart: libs, or to expose the ones that'll impact a particular app at runtime in the analysis report.

that's an interesting idea, maybe we can fix it partially instead of going all the way. I think @leafpetersen got pretty close though to fixing. He's out for a few weeks but maybe we can do something in the meantime.

@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> {
}

@vsmenon
Copy link
Contributor

vsmenon commented Jan 26, 2016

@Andersmholmgren I think you're hitting this bug: dart-lang/sdk#25530

Can you clarify what you mean by runtime? Are you running tests with DDC?

@Andersmholmgren
Copy link

I'm running pub run test on a project with strong mode enabled on the latest dev VM

@Andersmholmgren
Copy link

Yes the sdk issue sounds the same. Only thing is that it doesn't show up in the dart analyser tab of IntelliJ. Only when I run the tests

@jmesserly
Copy link
Contributor

"malbounded type" is an error coming from the Dart VM most likely (edit: for clarity. The term is in the spec, VM and dart2js issue the error. Analyzer doesn't use the same terminology, but has the same concept). I suspect you'll get the same error without strong mode. (Dart VM doesn't do anything different for strong mode, so "pub run test" would be unaffected.)

@leafpetersen
Copy link
Contributor

Closing this as basically stale. This covers a bunch of related issues that have either been fixed (core libraries strong mode clean) or have other bugs assigned to them (fix runtime cast ignores).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

5 participants