bugfix for builtin functions using 3-tuples

This commit is contained in:
Mark 2024-10-11 23:42:14 +02:00
parent 786d72660f
commit d83f6f942f
4 changed files with 12 additions and 9 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "mers" name = "mers"
version = "0.9.8" version = "0.9.9"
edition = "2021" edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "dynamically typed but type-checked programming language" 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"] colored-output = ["mers_lib/ecolor-term", "mers_lib/pretty-print", "dep:colored"]
[dependencies] [dependencies]
mers_lib = "0.9.8" mers_lib = "0.9.9"
# mers_lib = { path = "../mers_lib" } # mers_lib = { path = "../mers_lib" }
clap = { version = "4.3.19", features = ["derive"] } clap = { version = "4.3.19", features = ["derive"] }
colored = { version = "2.1.0", optional = true } colored = { version = "2.1.0", optional = true }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "mers_lib" name = "mers_lib"
version = "0.9.8" version = "0.9.9"
edition = "2021" edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "library to use the mers language in other projects" description = "library to use the mers language in other projects"

View File

@ -1,4 +1,4 @@
use std::{marker::PhantomData, sync::Arc}; use std::marker::PhantomData;
use crate::{ use crate::{
data::{self, Data, MersData, Type}, data::{self, Data, MersData, Type},
@ -59,10 +59,13 @@ pub trait StaticMersFunc: Sized + 'static + Send + Sync {
None => Err(CheckError::from(format!( None => Err(CheckError::from(format!(
"unexpected argument of type {}, expected {}", "unexpected argument of type {}, expected {}",
a.get().as_type().with_info(i), a.get().as_type().with_info(i),
Type::new(data::function::FunctionT( {
Err(Arc::new(Self::types())), let mut o = Type::empty();
crate::info::Info::neverused() for t in Self::types() {
)) o.add_all(&t.0);
}
o
}
.with_info(i) .with_info(i)
))), ))),
} }

View File

@ -288,7 +288,7 @@ impl<A: FromMersData, B: FromMersData, C: FromMersData> FromMersData for (A, B,
if let Some(v) = d if let Some(v) = d
.as_any() .as_any()
.downcast_ref::<data::tuple::Tuple>() .downcast_ref::<data::tuple::Tuple>()
.filter(|v| v.0.len() == 2) .filter(|v| v.0.len() == 3)
{ {
A::try_represent(v.0[0].get().as_ref(), |v1| { A::try_represent(v.0[0].get().as_ref(), |v1| {
if let Some(va) = v1 { if let Some(va) = v1 {