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

VM: return type not taken into account when checking function type assignability #6029

Closed
DartBot opened this issue Oct 18, 2012 · 3 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-as-intended Closed as the reported issue is expected behavior

Comments

@DartBot
Copy link

DartBot commented Oct 18, 2012

This issue was originally filed by [email protected]


see co19 test Language/10_Expressions/09_Function_Expressions_A03_t02:
typedef bool foo(int x, int y, [double a, double b]);

main() {
  foo f;
  checkTypeError( () {f = (int x, int y, [double a, double b]) => 1;});
}

According to spec Ch. 11.9, static type of a function literal includes information about static type of the return expression, so this assignment should result in a type error.

@dgrove
Copy link
Contributor

dgrove commented Oct 23, 2012

Added Area-VM, Triaged labels.

@iposva-google
Copy link
Contributor

Set owner to @crelier.
Added Accepted label.

@crelier
Copy link
Contributor

crelier commented Oct 24, 2012

Static types are not relevant to the VM, which only cares about actual types.

The actual return type of the function literal in this test is dynamic, according to spec ("If a function does not declare a return type explicitly, its return type is dynamic.").

So, no type error should be expected by this test or by Language/10_Expressions/09_Function_Expressions_A04_t02

I filed co19 issue #283.


Added AsDesigned label.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-as-intended Closed as the reported issue is expected behavior labels Oct 24, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-as-intended Closed as the reported issue is expected behavior
Projects
None yet
Development

No branches or pull requests

4 participants