1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: disallow using builtin type names for const names (#16599)

This commit is contained in:
Swastik Baranwal
2022-12-06 19:14:25 +05:30
committed by GitHub
parent 5fc7b6d3d6
commit ada8643ac5
8 changed files with 34 additions and 15 deletions

View File

@ -4,8 +4,8 @@ import time
import v.ast
pub const (
num64 = [ast.i64_type_idx, ast.u64_type_idx]
nums = [
num64 = [ast.i64_type_idx, ast.u64_type_idx]
nums = [
ast.i8_type_idx,
ast.i16_type_idx,
ast.int_type_idx,
@ -14,14 +14,14 @@ pub const (
ast.u32_type_idx,
ast.bool_type_idx,
]
float = [
float = [
ast.f32_type_idx,
ast.f64_type_idx,
]
string = ast.string_type_idx
time = -2
serial = -1
type_idx = {
type_string = ast.string_type_idx
time = -2
serial = -1
type_idx = {
'i8': ast.i8_type_idx
'i16': ast.i16_type_idx
'int': ast.int_type_idx

View File

@ -263,7 +263,7 @@ fn sql_type_from_v(typ int) !string {
'INT64'
} else if typ in orm.float {
'DOUBLE'
} else if typ == orm.string {
} else if typ == orm.type_string {
'TEXT'
} else if typ == -1 {
'SERIAL'