diff --git a/sixtyfps_compiler/builtin_macros.rs b/sixtyfps_compiler/builtin_macros.rs index 20d1abe36..e4db53c97 100644 --- a/sixtyfps_compiler/builtin_macros.rs +++ b/sixtyfps_compiler/builtin_macros.rs @@ -179,7 +179,6 @@ fn to_debug_string( match &ty { Type::Invalid => Expression::Invalid, Type::Void - | Type::InferredGenericType | Type::InferredCallback | Type::InferredProperty | Type::Component(_) diff --git a/sixtyfps_compiler/expression_tree.rs b/sixtyfps_compiler/expression_tree.rs index a63d576dc..0b80cb636 100644 --- a/sixtyfps_compiler/expression_tree.rs +++ b/sixtyfps_compiler/expression_tree.rs @@ -128,7 +128,7 @@ impl BuiltinFunction { }, BuiltinFunction::ArrayLength => Type::Function { return_type: Box::new(Type::Int32), - args: vec![Type::Array(Box::new(Type::InferredGenericType))], + args: vec![Type::Model], }, BuiltinFunction::Rgb => Type::Function { return_type: Box::new(Type::Color), @@ -991,7 +991,6 @@ impl Expression { pub fn default_value_for_type(ty: &Type) -> Expression { match ty { Type::Invalid - | Type::InferredGenericType | Type::Component(_) | Type::Builtin(_) | Type::Native(_) diff --git a/sixtyfps_compiler/generator/cpp.rs b/sixtyfps_compiler/generator/cpp.rs index 5ef8a6a2d..5721531e1 100644 --- a/sixtyfps_compiler/generator/cpp.rs +++ b/sixtyfps_compiler/generator/cpp.rs @@ -1628,7 +1628,7 @@ fn compile_expression( "[](const sixtyfps::Image &img) { return img.size(); }".into() } BuiltinFunction::ArrayLength => { - "[](const sixtyfps::Model &model) { return (int) model.row_count(); }".into() + "[](const auto &model) { return (int) model.row_count(); }".into() } BuiltinFunction::Rgb => { "[](int r, int g, int b, float a) {{ return sixtyfps::Color::from_argb_uint8(std::clamp(a * 255., 0., 255.), std::clamp(r, 0, 255), std::clamp(g, 0, 255), std::clamp(b, 0, 255)); }}".into() diff --git a/sixtyfps_compiler/langtype.rs b/sixtyfps_compiler/langtype.rs index 18797b347..7d58d604a 100644 --- a/sixtyfps_compiler/langtype.rs +++ b/sixtyfps_compiler/langtype.rs @@ -76,14 +76,11 @@ pub enum Type { /// This is a `SharedArray` LayoutCache, - - InferredGenericType, } impl core::cmp::PartialEq for Type { fn eq(&self, other: &Self) -> bool { match self { - Type::InferredGenericType => true, Type::Invalid => matches!(other, Type::Invalid), Type::Void => matches!(other, Type::Void), Type::InferredProperty => matches!(other, Type::InferredProperty), @@ -127,7 +124,6 @@ impl core::cmp::PartialEq for Type { impl Display for Type { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Type::InferredGenericType => write!(f, "<_>"), Type::Invalid => write!(f, ""), Type::Void => write!(f, "void"), Type::InferredProperty => write!(f, "?"), @@ -473,7 +469,6 @@ impl Type { // Unit::Percent is special that it does not combine with other units like Type::Percent => None, Type::Angle => Some(Unit::Deg), - Type::InferredGenericType => None, Type::Invalid => None, Type::Void => None, Type::InferredProperty | Type::InferredCallback => None,