mirror of
https://github.com/vlang/v.git
synced 2025-09-14 18:06:48 -04:00
This commit is contained in:
parent
f7734165af
commit
49e1012baf
@ -1726,6 +1726,10 @@ fn (mut c Checker) selector_expr(mut node ast.SelectorExpr) ast.Type {
|
||||
c.check_or_expr(node.or_block, unwrapped_typ, c.expected_or_type, node)
|
||||
c.expected_or_type = ast.void_type
|
||||
}
|
||||
if c.pref.skip_unused && node.or_block.kind != .absent
|
||||
&& !c.table.used_features.option_or_result {
|
||||
c.table.used_features.option_or_result = true
|
||||
}
|
||||
return field.typ
|
||||
}
|
||||
if mut method := c.table.sym(c.unwrap_generic(typ)).find_method_with_generic_parent(field_name) {
|
||||
|
1
vlib/v/tests/skip_unused/selector_option.run.out
Normal file
1
vlib/v/tests/skip_unused/selector_option.run.out
Normal file
@ -0,0 +1 @@
|
||||
2
|
@ -0,0 +1 @@
|
||||
2
|
15
vlib/v/tests/skip_unused/selector_option.vv
Normal file
15
vlib/v/tests/skip_unused/selector_option.vv
Normal file
@ -0,0 +1,15 @@
|
||||
module main
|
||||
|
||||
struct GameObject {
|
||||
mut:
|
||||
id int = 1
|
||||
parent ?&GameObject
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mut gameobject := GameObject{}
|
||||
gameobject.parent = &GameObject{
|
||||
id: 2
|
||||
}
|
||||
println('${gameobject.parent?.id}')
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user