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

Ceylon backend error on generic function combined with other generic function #2415

Open
renatoathaydes opened this issue Nov 3, 2015 · 0 comments
Labels
Milestone

Comments

@renatoathaydes
Copy link

Sorry for the vague title, but I don't know what's going on exactly here...

Here's my code:

    value parser = many(infix(
        word(), separatedBy<Character>, infix(
            character(','), around<Character>, spaces())));

It's from my library of parser combinators!

I'm experimenting with this infix function that makes parsers very readable, as you probably agree seeing the above.

Even though the IDE seems to accept this code (no highlighted errors), a backend error occurs:

method separatedBy$minOccurrences in class com.athaydes.parcey.combinator.separatedBy_ cannot be applied to given types;
  required: com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor,com.athaydes.parcey.Parser<? extends java.lang.Object>,com.athaydes.parcey.Parser<? extends ceylon.language.Iterable<? extends Item,? extends java.lang.Object>>
  found: com.athaydes.parcey.Parser,com.athaydes.parcey.Parser
  reason: cannot instantiate from arguments because actual and formal argument lists differ in length   helperFunctionsTests.ceylon /parcey/source/test/com/athaydes/parcey Unknown Ceylon Backend Error

The definition of infix is this:

shared Parser<Result> infix<First, Second, Result>(
    Parser<First> first,
    Parser<Result>(Parser<First>, Parser<Second>) operator,
    Parser<Second> second)
        => operator(first, second);

The error showed up when I added the separatedBy function, which has this signature:

shared Parser<{Item*}> separatedBy<Item>(
    Parser<Anything> separator,
    Parser<{Item*}> parser,
    Integer minOccurrences = 0,
    String name = "")

Hope this is enough info. Let me know if you need more (the source code of this project is on GitHub if you need it, the link again).

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

No branches or pull requests

2 participants