Skip to content

Commit

Permalink
ci fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MCausc78 committed Mar 1, 2024
1 parent 66f7a19 commit 5ff4deb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions vlib/v/checker/checker.v
Original file line number Diff line number Diff line change
Expand Up @@ -3083,18 +3083,19 @@ fn (mut c Checker) cast_expr(mut node ast.CastExpr) ast.Type {
tt := c.table.type_to_str(to_type)
c.error('cannot cast `${ft}` to `${tt}`', node.pos)
} else if to_sym_info.variants.len != to_sym_info.get_deduplicated_variants().len {
mut msg := ?string(none)
// not a option type because of autofree bug; see https://github.com/vlang/v/actions/runs/8116684464/job/22187255774?pr=20936
mut msg := ''
print_notice := to_sym_info.attrs.any(!it.has_arg && it.name == 'notice_if_duplicate')
for attr in to_sym_info.attrs {
if attr.name == 'on_duplicate' && attr.has_arg {
msg = attr.arg
}
}
if s := msg {
if msg.len > 0 {
if print_notice {
c.note('duplicate type: ${s}', node.pos)
c.note('duplicate type: ${msg}', node.pos)
} else {
c.error('duplicate type: ${s}', node.pos)
c.error('duplicate type: ${msg}', node.pos)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
vlib/v/checker/tests/notice_or_error_on_duplicate_using_generic.vv:9:7: notice: duplicate type: blah blah blah 11111
7 |
7 |
8 | fn main() {
9 | _ := Name1[int](123)
| ~~~~~~~~~~~~~~~
9 | _ := Name1[int](123)
| ~~~~~~~~~~~~~~~
10 | _ := Name2[int](456)
11 | }
11 | }
vlib/v/checker/tests/notice_or_error_on_duplicate_using_generic.vv:10:7: error: duplicate type: blah blah blah 22222
8 | fn main() {
8 | fn main() {
9 | _ := Name1[int](123)
10 | _ := Name2[int](456)
| ~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 5ff4deb

Please sign in to comment.