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

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

Closed
leafpetersen opened this issue Aug 17, 2017 · 0 comments
Closed

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

leafpetersen opened this issue Aug 17, 2017 · 0 comments

Comments

@leafpetersen
Copy link
Member

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

natebosch added a commit that referenced this issue Aug 22, 2017
Fixes #674

dynamic is treated as the bottom type for function arguments, but this
will soon change. Null will continue to be the bottom type.

The question we are asking is "Is this a function that takes one
argument", when dynamic is no longer the bottom type the question will
become "Is this a function that takes one dynamic argument", and a
function which take one argument of a specific type does *not* take a
dynamic argument.
natebosch added a commit that referenced this issue Aug 22, 2017
Fixes #674

dynamic is treated as the bottom type for function arguments, but this
will soon change. Null will continue to be the bottom type.

The question we are asking is "Is this a function that takes one
argument", when dynamic is no longer the bottom type the question will
become "Is this a function that takes one dynamic argument", and a
function which take one argument of a specific type does *not* take a
dynamic argument.
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

1 participant