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

Improve error message for function param type inference #1420

Open
FroMage opened this issue Sep 11, 2015 · 2 comments
Open

Improve error message for function param type inference #1420

FroMage opened this issue Sep 11, 2015 · 2 comments
Milestone

Comments

@FroMage
Copy link
Member

FroMage commented Sep 11, 2015

The following call:

    print(textFile.filter((line) => line.contains("Ceylon")).count());

Where filter does not accept a Callable, produces the following errors:

test.ceylon:35: error: parameter declaration does not exist: 'line'
    print(textFile.filter((line) => line.contains("Ceylon")).count());
                           ^
test.ceylon:35: error: function or value does not exist: 'line'
    print(textFile.filter((line) => line.contains("Ceylon")).count());
                                    ^
test.ceylon:35: error: function or value does not exist: 'line'
    print(textFile.filter((line) => line.contains("Ceylon")).count());
                                    ^

I'd really find the first one to be a lot clearer if it said something like cannot infer parameter type: left-hand-side does not accept functions: TextFile.filter. Although left-hand-side may still be too cryptic for users but I can't think of a better term ATM.

Also, I'm pretty sure we should get rid of the duplicate (third) error.

@FroMage FroMage added this to the 1.2 milestone Sep 11, 2015
@gavinking
Copy link
Member

I already did some work on this in @77b9dcca41f97af7ace80eca32d409efcc5c298b

@FroMage
Copy link
Member Author

FroMage commented Sep 11, 2015

OK, that's better. But is there no way to explain why it can't be inferred? At least pointing to the expected type Function would help.

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