temporary nil fn check
parent
25e7ceeef0
commit
0b235cc893
|
@ -628,6 +628,9 @@ fn type_default(typ string) string {
|
||||||
if typ.contains('__') {
|
if typ.contains('__') {
|
||||||
return '{0}'
|
return '{0}'
|
||||||
}
|
}
|
||||||
|
if typ.ends_with('Fn') { // TODO
|
||||||
|
return '0'
|
||||||
|
}
|
||||||
// Default values for other types are not needed because of mandatory initialization
|
// Default values for other types are not needed because of mandatory initialization
|
||||||
match typ {
|
match typ {
|
||||||
'bool' {
|
'bool' {
|
||||||
|
|
|
@ -621,6 +621,10 @@ fn (p mut Parser) check_types2(got_, expected_ string, throw bool) bool {
|
||||||
if got.starts_with('varg_') {
|
if got.starts_with('varg_') {
|
||||||
got = got[5..]
|
got = got[5..]
|
||||||
}
|
}
|
||||||
|
// fn == 0 temporary
|
||||||
|
if got == 'int' && expected.ends_with('Fn') {
|
||||||
|
return true
|
||||||
|
}
|
||||||
// Allow ints to be used as floats
|
// Allow ints to be used as floats
|
||||||
if got == 'int' && expected == 'f32' {
|
if got == 'int' && expected == 'f32' {
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue