Skip to content

Commit

Permalink
simplify check
Browse files Browse the repository at this point in the history
  • Loading branch information
Delta456 committed Oct 2, 2024
1 parent 956102d commit b4a2219
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions vlib/v/checker/checker.v
Original file line number Diff line number Diff line change
Expand Up @@ -3191,10 +3191,8 @@ fn (mut c Checker) cast_expr(mut node ast.CastExpr) ast.Type {
return to_type
}

type_str := c.table.type_to_str(to_type)
type_rm_ptr := type_str.replace('&', '')
if !c.expected_type.has_flag(.generic) && type_rm_ptr.len == 1
&& type_rm_ptr.starts_with_capital() {
if !c.expected_type.has_flag(.generic) && to_sym.name.len == 1
&& to_sym.name.starts_with_capital() {
c.error('unknown type `${to_sym.name}`', node.pos)
}

Expand Down

0 comments on commit b4a2219

Please sign in to comment.