refactor(ast): rename value types to Number/Decimal/Text/Boolean
Renamed AST value types for v0.3 naming convention: - Value::Int -> Value::Number - Value::Float -> Value::Decimal - Value::String -> Value::Text - Value::Bool -> Value::Boolean - Expr::IntLit -> Expr::NumberLit - Expr::FloatLit -> Expr::DecimalLit - Expr::StringLit -> Expr::TextLit - Expr::BoolLit -> Expr::BooleanLit Updated all references across parser, resolver, validator, LSP, query engine, tests, and editor.
This commit is contained in:
@@ -54,12 +54,12 @@ fn valid_ident() -> impl Strategy<Value = String> {
|
||||
|
||||
fn valid_value() -> impl Strategy<Value = Value> {
|
||||
prop_oneof![
|
||||
(-1000i64..1000).prop_map(Value::Int),
|
||||
(-1000i64..1000).prop_map(Value::Number),
|
||||
(-1000.0..1000.0)
|
||||
.prop_filter("finite", |f: &f64| f.is_finite())
|
||||
.prop_map(Value::Float),
|
||||
any::<bool>().prop_map(Value::Bool),
|
||||
"[a-zA-Z0-9 ]{0,30}".prop_map(Value::String),
|
||||
.prop_map(Value::Decimal),
|
||||
any::<bool>().prop_map(Value::Boolean),
|
||||
"[a-zA-Z0-9 ]{0,30}".prop_map(Value::Text),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -296,22 +296,22 @@ mod edge_cases {
|
||||
fields: vec![
|
||||
Field {
|
||||
name: "int_field".to_string(),
|
||||
value: Value::Int(int_val),
|
||||
value: Value::Number(int_val),
|
||||
span: Span::new(0, 10),
|
||||
},
|
||||
Field {
|
||||
name: "float_field".to_string(),
|
||||
value: Value::Float(float_val),
|
||||
value: Value::Decimal(float_val),
|
||||
span: Span::new(10, 20),
|
||||
},
|
||||
Field {
|
||||
name: "bool_field".to_string(),
|
||||
value: Value::Bool(bool_val),
|
||||
value: Value::Boolean(bool_val),
|
||||
span: Span::new(20, 30),
|
||||
},
|
||||
Field {
|
||||
name: "string_field".to_string(),
|
||||
value: Value::String(string_val.clone()),
|
||||
value: Value::Text(string_val.clone()),
|
||||
span: Span::new(30, 40),
|
||||
},
|
||||
],
|
||||
@@ -322,10 +322,10 @@ mod edge_cases {
|
||||
};
|
||||
|
||||
let resolved = convert_character(&character).unwrap();
|
||||
assert_eq!(resolved.fields.get("int_field"), Some(&Value::Int(int_val)));
|
||||
assert_eq!(resolved.fields.get("float_field"), Some(&Value::Float(float_val)));
|
||||
assert_eq!(resolved.fields.get("bool_field"), Some(&Value::Bool(bool_val)));
|
||||
assert_eq!(resolved.fields.get("string_field"), Some(&Value::String(string_val)));
|
||||
assert_eq!(resolved.fields.get("int_field"), Some(&Value::Number(int_val)));
|
||||
assert_eq!(resolved.fields.get("float_field"), Some(&Value::Decimal(float_val)));
|
||||
assert_eq!(resolved.fields.get("bool_field"), Some(&Value::Boolean(bool_val)));
|
||||
assert_eq!(resolved.fields.get("string_field"), Some(&Value::Text(string_val)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -341,7 +341,7 @@ mod edge_cases {
|
||||
species: None,
|
||||
fields: vec![Field {
|
||||
name: field_name.clone(),
|
||||
value: Value::String(string_val.clone()),
|
||||
value: Value::Text(string_val.clone()),
|
||||
span: Span::new(0, 10),
|
||||
}],
|
||||
template: None,
|
||||
@@ -354,7 +354,7 @@ mod edge_cases {
|
||||
assert_eq!(resolved.name, name);
|
||||
assert_eq!(
|
||||
resolved.fields.get(&field_name),
|
||||
Some(&Value::String(string_val))
|
||||
Some(&Value::Text(string_val))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user