Skip to content

[Bug] parser not accounting for module-prefixed type names in foreach loop #3423

Description

@lyranie

When attempting to use a module-prefixed type name in a foreach loop the parser sees the : and assumes it's a untyped variable e.g. foreach (foo : {}) {

 1: module test;
 2: 
 3: fn void main() {
 4:     foreach (foo::Foo f : {}) {
                    ^^
(/home/allie/Documents/code-probe/lol.c3l/test.c3:4:17) Error: Expected ':'.

Here's a minimal reproduction

module test;

fn void main() {
    foreach (foo::Foo f : {}) {
    }
}

module foo;

typedef Foo = int;

Activity

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

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingFixed needs testingNeeds verification / testing that it now works

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions