Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Improve error message for function param type inference #4526

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

Improve error message for function param type inference #4526

CeylonMigrationBot opened this issue Sep 11, 2015 · 2 comments

Comments

@CeylonMigrationBot
Copy link

[@FroMage] 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.

[Migrated from ceylon/ceylon-spec#1420]

@CeylonMigrationBot
Copy link
Author

[@gavinking] I already did some work on this in @77b9dcca41f97af7ace80eca32d409efcc5c298b

@CeylonMigrationBot
Copy link
Author

[@FroMage] 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant