Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checker: fix typeof of typeof.name #19323

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vlib/v/gen/c/comptime.v
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ fn (mut g Gen) get_comptime_var_type(node ast.Expr) ast.Type {
fn (mut g Gen) resolve_comptime_type(node ast.Expr, default_type ast.Type) ast.Type {
if (node is ast.Ident && g.is_comptime_var(node)) || node is ast.ComptimeSelector {
return g.get_comptime_var_type(node)
} else if node is ast.SelectorExpr {
} else if node is ast.SelectorExpr && node.expr_type != 0 {
sym := g.table.sym(g.unwrap_generic(node.expr_type))
if f := g.table.find_field_with_embeds(sym, node.field_name) {
return f.typ
Expand Down
6 changes: 6 additions & 0 deletions vlib/v/tests/typeof_name_test.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn test_main() {
pi := 3.14
type_ := typeof(pi).name
assert typeof(type_).name == 'string'
assert typeof(typeof(pi).name).name == 'string'
}
Loading