File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,7 +125,9 @@ fn (mut c Checker) markused_call_expr(mut node ast.CallExpr) {
125125
126126fn (mut c Checker) markused_fn_call (mut node ast.CallExpr) {
127127 if ! c.is_builtin_mod && c.mod != 'math.bits' && node.args[0 ].expr ! is ast.StringLiteral {
128- if ! c.table.sym (c.unwrap_generic (node.args[0 ].typ)).has_method ('str' ) {
128+ if (node.args[0 ].expr is ast.CallExpr && node.args[0 ].expr.is_method
129+ && node.args[0 ].expr.name == 'str' )
130+ || ! c.table.sym (c.unwrap_generic (node.args[0 ].typ)).has_method ('str' ) {
129131 c.table.used_features.auto_str = true
130132 } else {
131133 if node.args[0 ].typ.has_option_or_result () {
Original file line number Diff line number Diff line change 1+ &TreeTwo{
2+ Tree:
3+ }
Original file line number Diff line number Diff line change 1+ &TreeTwo{
2+ Tree:
3+ }
Original file line number Diff line number Diff line change 1+ module main
2+
3+ pub struct Tree {}
4+
5+ pub fn (tree &Tree) str() string {
6+ return ''
7+ }
8+
9+ pub struct TreeTwo {
10+ Tree
11+ }
12+
13+ pub fn TreeTwo.from_string(tree_string string) !&TreeTwo {
14+ return &TreeTwo{}
15+ }
16+
17+ fn main() {
18+ tree := TreeTwo.from_string('') or { panic(err) }
19+ println(tree.str())
20+ }
You can’t perform that action at this time.
0 commit comments