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

MappingDefinition: function with optional params results in compile-time error #266

Open
gene-pavlovsky opened this issue Feb 26, 2018 · 2 comments

Comments

@gene-pavlovsky
Copy link

I'd like to have this in my array of MappingDefinitions, supplies as dependencies to an IDependencyOwner:
mapping({fromType: "?String->Void", toValue: fooController.bar, withName: "bar"}).

The dependency owner has this:
@Dependency(var bar:?String->Void)

HM 0.35.0 compile error: Missing mappings:[Null<String>->Void|bar]
Changing fromType in DSL to Null<String>->Void - the code compiles. But the type is not exactly right (e.g. my function has a default non-null value for the string param).

HM 0.34.0 compile error: Missing mappings:[Dynamic->Void|bar]
Changing fromType in DSL to Dynamic->Void - the code compiles. But this is not safe (I can pass e.g.
a Bool->Void function and it compiles.

@FrancisBourre
Copy link
Collaborator

Thanks for the report. You're right, optional arguments are not handled by the checker yet. I will add it.

@gene-pavlovsky
Copy link
Author

Thank you! Lovely :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants