checker: small cleanup of commit edc6c9e
parent
edc6c9e24f
commit
71d98717dc
|
@ -3708,8 +3708,9 @@ pub fn (mut c Checker) enum_val(mut node ast.EnumVal) ast.Type {
|
||||||
c.error('unknown enum `$node.enum_name` (type_idx=0)', node.pos)
|
c.error('unknown enum `$node.enum_name` (type_idx=0)', node.pos)
|
||||||
return ast.void_type
|
return ast.void_type
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
// if module prefix specified enum name given
|
if typ_idx == 0 {
|
||||||
|
// the actual type is still unknown, produce an error, instead of panic:
|
||||||
c.error('unknown enum `$node.enum_name` (type_idx=0)', node.pos)
|
c.error('unknown enum `$node.enum_name` (type_idx=0)', node.pos)
|
||||||
return ast.void_type
|
return ast.void_type
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
vlib/v/checker/tests/enum_error_module.vv:5:13: error: unknown enum `missing_enum.ColoList` (type_idx=0)
|
vlib/v/checker/tests/enum_error_module.vv:4:12: error: unknown enum `time.NonExistingEnum` (type_idx=0)
|
||||||
|
2 |
|
||||||
3 | fn main() {
|
3 | fn main() {
|
||||||
4 | mut c := me.Color{
|
4 | _ := time.NonExistingEnum.black
|
||||||
5 | color: me.ColoList.black
|
| ~~~~~~~~~~~~~~~~~~~~~
|
||||||
| ~~~~~~~~~~~~~~
|
5 | }
|
||||||
6 | }
|
|
||||||
7 | println(c)
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
import missing_enum as me
|
import time
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
mut c := me.Color{
|
_ := time.NonExistingEnum.black
|
||||||
color: me.ColoList.black
|
|
||||||
}
|
|
||||||
println(c)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
vlib/v/checker/tests/modules/missing_enum/main.v:1:1: error: project must include a `main` module or be a shared library (compile with `v -shared`)
|
|
||||||
1 | module missing_enum
|
|
||||||
| ^
|
|
||||||
2 |
|
|
||||||
3 | pub enum ColorList {
|
|
|
@ -1,12 +0,0 @@
|
||||||
module missing_enum
|
|
||||||
|
|
||||||
pub enum ColorList {
|
|
||||||
red
|
|
||||||
blue
|
|
||||||
green
|
|
||||||
black
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Color {
|
|
||||||
color ColorList
|
|
||||||
}
|
|
Loading…
Reference in New Issue