From d83f6f942fd2063a97f4090140a3c09d5a04bda8 Mon Sep 17 00:00:00 2001 From: Mark <> Date: Fri, 11 Oct 2024 23:42:14 +0200 Subject: [PATCH] bugfix for builtin functions using 3-tuples --- mers/Cargo.toml | 4 ++-- mers_lib/Cargo.toml | 2 +- mers_lib/src/program/configs/gen/function.rs | 13 ++++++++----- mers_lib/src/program/configs/gen/mod.rs | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mers/Cargo.toml b/mers/Cargo.toml index da7a9de..7bfc3c4 100644 --- a/mers/Cargo.toml +++ b/mers/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mers" -version = "0.9.8" +version = "0.9.9" edition = "2021" license = "MIT OR Apache-2.0" description = "dynamically typed but type-checked programming language" @@ -15,7 +15,7 @@ default = ["colored-output"] colored-output = ["mers_lib/ecolor-term", "mers_lib/pretty-print", "dep:colored"] [dependencies] -mers_lib = "0.9.8" +mers_lib = "0.9.9" # mers_lib = { path = "../mers_lib" } clap = { version = "4.3.19", features = ["derive"] } colored = { version = "2.1.0", optional = true } diff --git a/mers_lib/Cargo.toml b/mers_lib/Cargo.toml index f8c3fd6..c7a21bb 100755 --- a/mers_lib/Cargo.toml +++ b/mers_lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mers_lib" -version = "0.9.8" +version = "0.9.9" edition = "2021" license = "MIT OR Apache-2.0" description = "library to use the mers language in other projects" diff --git a/mers_lib/src/program/configs/gen/function.rs b/mers_lib/src/program/configs/gen/function.rs index 4335bc2..7ad7218 100644 --- a/mers_lib/src/program/configs/gen/function.rs +++ b/mers_lib/src/program/configs/gen/function.rs @@ -1,4 +1,4 @@ -use std::{marker::PhantomData, sync::Arc}; +use std::marker::PhantomData; use crate::{ data::{self, Data, MersData, Type}, @@ -59,10 +59,13 @@ pub trait StaticMersFunc: Sized + 'static + Send + Sync { None => Err(CheckError::from(format!( "unexpected argument of type {}, expected {}", a.get().as_type().with_info(i), - Type::new(data::function::FunctionT( - Err(Arc::new(Self::types())), - crate::info::Info::neverused() - )) + { + let mut o = Type::empty(); + for t in Self::types() { + o.add_all(&t.0); + } + o + } .with_info(i) ))), } diff --git a/mers_lib/src/program/configs/gen/mod.rs b/mers_lib/src/program/configs/gen/mod.rs index 5502d2f..9b818df 100644 --- a/mers_lib/src/program/configs/gen/mod.rs +++ b/mers_lib/src/program/configs/gen/mod.rs @@ -288,7 +288,7 @@ impl FromMersData for (A, B, if let Some(v) = d .as_any() .downcast_ref::() - .filter(|v| v.0.len() == 2) + .filter(|v| v.0.len() == 3) { A::try_represent(v.0[0].get().as_ref(), |v1| { if let Some(va) = v1 {