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

Forward reference causes function type mismatch error #30015

Open
jclark opened this issue Apr 16, 2021 · 0 comments
Open

Forward reference causes function type mismatch error #30015

jclark opened this issue Apr 16, 2021 · 0 comments
Labels
Area/CodeAnalysis Data flow , Code and Closure analysis related issues #Compiler Lang/ClassDefinition issues related to classes Lang/Iterable Iterable, range expression related issues Priority/High Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug

Comments

@jclark
Copy link

jclark commented Apr 16, 2021

With slalpha4, this:

import ballerina/io;

class MyIterable {
    *object:Iterable;

    public function iterator() returns MyIterator {
        return new;
    }

}

public class MyIterator {
    public function next() returns record {| int value; |}? {
        return ();
    }
}


public function main() {
   foreach var i in new MyIterable() {
     io:println(i);
   }
}

gets a mismatched function signatures compile error. The error goes away if I move the declaration of MyIterator to before MyIterable.

@anupama-pathirage anupama-pathirage added the Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. label Jun 12, 2021
@gimantha gimantha added Priority/High Lang/ClassDefinition issues related to classes Lang/Iterable Iterable, range expression related issues Area/CodeAnalysis Data flow , Code and Closure analysis related issues #Compiler labels Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/CodeAnalysis Data flow , Code and Closure analysis related issues #Compiler Lang/ClassDefinition issues related to classes Lang/Iterable Iterable, range expression related issues Priority/High Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug
Projects
None yet
Development

No branches or pull requests

3 participants