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

support universal function types #526

Closed
3 tasks
jmesserly opened this issue Apr 25, 2016 · 1 comment
Closed
3 tasks

support universal function types #526

jmesserly opened this issue Apr 25, 2016 · 1 comment

Comments

@jmesserly
Copy link
Contributor

jmesserly commented Apr 25, 2016

Initial implementation of #301 may not cover this.

  • ensure these have a runtime representation (likely done as part of Reify type in "generic" methods #301)
  • implement subtyping rules
  • prevent these types from being treated as callable functions (e.g. (f.runtimeType as dynamic)(int) where f is a generic function). Discussed at the end.

These can't be written down yet, but they can come up in inference, for example:

/*=T*/ f/*<T>*/(/*=T*/x) => x;
main() {
  var y = f;
  y = /*<S>*/(y) => y; // legal
}

Note the generic function expression is #527

I'm not aware of this blocking anything, but for consistentcy with Analyzer we should support it.

Regarding "prevent these types from being treated as callable functions": we may need to split out into its own bug, as it likely requires changing how generic classes look. Generic class types & function typedefs are callable, which was okay because they weren't accessible as first-class values. But universal function types can be gotten from .runtimeType, and will likely have a literal form as well: MyGenericFnType. It's not a huge problem if that value is "dynamically callable", since the Type interface does not say anything about supporting call, but it seems suboptimal.

@jmesserly jmesserly changed the title support universal function types support universal function types, generic lambda expressions Apr 25, 2016
@jmesserly jmesserly changed the title support universal function types, generic lambda expressions support universal function types Apr 25, 2016
@jmesserly
Copy link
Contributor Author

This issue was moved to dart-lang/sdk#27333

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

No branches or pull requests

1 participant