Skip to content

Commit ba97785

Browse files
authored
checker: clear all ref from autostr receiver_type (needed by #25857) (#26202)
1 parent 3de2228 commit ba97785

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

vlib/v/ast/types.v

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,12 @@ pub fn (t Type) clear_flags(flags ...TypeFlag) Type {
446446
}
447447
}
448448

449+
// clear_ref clear refs of type
450+
@[inline]
451+
pub fn (t Type) clear_ref() Type {
452+
return t & ~0x00FF_0000
453+
}
454+
449455
// clear option and result flags
450456
@[inline]
451457
pub fn (t Type) clear_option_and_result() Type {

vlib/v/checker/fn.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2305,7 +2305,7 @@ fn (mut c Checker) method_call(mut node ast.CallExpr, mut continue_check &bool)
23052305
c.error('interface `${iname}` does not have a .str() method. Use typeof() instead',
23062306
node.pos)
23072307
}
2308-
node.receiver_type = left_type
2308+
node.receiver_type = left_type.clear_ref()
23092309
node.return_type = ast.string_type
23102310
if node.args.len > 0 {
23112311
c.error('.str() method calls should have no arguments', node.pos)

0 commit comments

Comments
 (0)