Skip to content

Empty array literal type inference when calling a method doesn't work #2208

@quasilyte

Description

@quasilyte
options gen2

class Example {
    def foo(xs : array<int>) {
    }

    def bar() {
        foo([])
    }
}

[export]
def main() {
}

This gives an error:

error[30105]: array type is not fully resolved: 'auto'
error[30103]: incompatible argument 2
main2.das:8:8
        foo([])
        ^^^
	array<auto> vs array<int> const
		invalid argument '2' (1). expecting 'array<int> const', passing 'array<auto>'


error[30101]: undefined structure type array<auto>
main2.das:8:12
        foo([])
            ^

These work fine:

options gen2

class Example {
    def foo(xs : array<int>) {
    }

    def bar() {
        foo(array<int>()) // OK
        foo(default<array<int>>) // OK
    }
}

[export]
def main() {
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions