Skip to content

Arity checks should be changed to use Null instead of dynamic #674

Closed
@leafpetersen

Description

@leafpetersen

This package (including at least code in expect_async) uses the pattern of defining a function type taking dynamic arguments and using this to test arity via an is check:

typedef _Func1(a);

...

if (f is Func1) ...

This currently works in DDC because of the special treatment of function types with dynamic arguments, but this treatment is going away now that we have moved Null to the bottom of the hierarchy and can use that. This code needs to be updated to use the following essentially almost equivalent pattern instead:

typedef _Func1(Null a);

...

if (f is Func1) ...

Note that this is only mostly equivalent, in that it changed what f gets promoted to. If f is called in the scope of the promotion to Func1, this call must be made explicitly dynamic to recover the previous semantics: (f as dynamic)(args).

Activity

added a commit that references this issue on Aug 22, 2017
20f42e0
added a commit that references this issue on Aug 22, 2017
e147e2b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @leafpetersen

        Issue actions

          Arity checks should be changed to use Null instead of dynamic · Issue #674 · dart-lang/test