v icon indicating copy to clipboard operation
v copied to clipboard

When struct is initalized with wrong type for field and field is named, compiler fails

Open jrenner opened this issue 7 years ago • 1 comments

fn main() {
    p := Person{name:'robert', age:'cat'}
    println('name: ${p.name}, age: ${p.age}')
}

struct Person {
    name string
    age int 
}

You just found a bug. V can't compile this program, but it should. Please create a GitHub issue.

jrenner avatar Jun 21 '19 00:06 jrenner

I doubt whether this is really a bug. The developer clearly makes a mistake here and I think it should not be able to compile.

Bowero avatar Jun 26 '19 19:06 Bowero