@@ -1147,11 +1147,11 @@ fn (mut c Checker) check_expr_option_or_result_call(expr ast.Expr, ret_type ast.
1147
1147
mut expr_ret_type := expr.return_type
1148
1148
if expr_ret_type != 0 && c.table.sym (expr_ret_type).kind == .alias {
1149
1149
unaliased_ret_type := c.table.unaliased_type (expr_ret_type)
1150
- if unaliased_ret_type.has_flag (.option) || unaliased_ret_type. has_flag (.result ) {
1150
+ if unaliased_ret_type.has_option_or_result ( ) {
1151
1151
expr_ret_type = unaliased_ret_type
1152
1152
}
1153
1153
}
1154
- if expr_ret_type.has_flag (.option) || expr_ret_type. has_flag (.result ) {
1154
+ if expr_ret_type.has_option_or_result ( ) {
1155
1155
return_modifier_kind := if expr_ret_type.has_flag (.option) {
1156
1156
'an Option'
1157
1157
} else {
@@ -1179,7 +1179,7 @@ fn (mut c Checker) check_expr_option_or_result_call(expr ast.Expr, ret_type ast.
1179
1179
}
1180
1180
ast.SelectorExpr {
1181
1181
if c.table.sym (ret_type).kind != .chan {
1182
- if expr.typ.has_flag (.option) || expr.typ. has_flag (.result ) {
1182
+ if expr.typ.has_option_or_result ( ) {
1183
1183
with_modifier_kind := if expr.typ.has_flag (.option) {
1184
1184
'an Option'
1185
1185
} else {
@@ -2671,11 +2671,11 @@ pub fn (mut c Checker) expr(mut node ast.Expr) ast.Type {
2671
2671
mut ret_type := c.call_expr (mut node)
2672
2672
if ret_type != 0 && c.table.sym (ret_type).kind == .alias {
2673
2673
unaliased_type := c.table.unaliased_type (ret_type)
2674
- if unaliased_type.has_flag (.option) || unaliased_type. has_flag (.result ) {
2674
+ if unaliased_type.has_option_or_result ( ) {
2675
2675
ret_type = unaliased_type
2676
2676
}
2677
2677
}
2678
- if ! ret_type.has_flag (.option) && ! ret_type. has_flag (.result ) {
2678
+ if ! ret_type.has_option_or_result ( ) {
2679
2679
c.expr_or_block_err (node.or_block.kind, node.name, node.or_block.pos,
2680
2680
false )
2681
2681
}
@@ -3586,8 +3586,7 @@ fn (mut c Checker) ident(mut node ast.Ident) ast.Type {
3586
3586
if c.inside_interface_deref && c.table.is_interface_var (obj) {
3587
3587
typ = typ.deref ()
3588
3588
}
3589
- is_option := typ.has_flag (.option) || typ.has_flag (.result)
3590
- || node.or_expr.kind != .absent
3589
+ is_option := typ.has_option_or_result () || node.or_expr.kind != .absent
3591
3590
node.kind = .variable
3592
3591
node.info = ast.IdentVar{
3593
3592
typ: typ
@@ -4297,7 +4296,7 @@ fn (mut c Checker) check_index(typ_sym &ast.TypeSymbol, index ast.Expr, index_ty
4297
4296
}
4298
4297
}
4299
4298
}
4300
- if index_type.has_flag (.option) || index_type. has_flag (.result ) {
4299
+ if index_type.has_option_or_result ( ) {
4301
4300
type_str := if typ_sym.kind == .string {
4302
4301
'(type `${typ_sym.name} `)'
4303
4302
} else {
0 commit comments