mirror of
https://github.com/Dummi26/mers.git
synced 2025-12-14 11:16:17 +01:00
Added the concept of subtypes ...
... which `try` now uses to avoid some problems with inner types
This commit is contained in:
@@ -28,7 +28,7 @@ impl Config {
|
||||
}
|
||||
let arg_type = &t.0[0];
|
||||
let functions = &t.0[1];
|
||||
for arg_type in arg_type.types.iter() {
|
||||
for arg_type in arg_type.subtypes_type().types.iter() {
|
||||
let arg_type = Type::newm(vec![arg_type.clone()]);
|
||||
// possibilities for the tuple (f1, f2, f3, ..., fn)
|
||||
for ft in functions.types.iter() {
|
||||
|
||||
@@ -83,7 +83,7 @@ impl Config {
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct RunCommandError(String);
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RunCommandErrorT;
|
||||
impl MersData for RunCommandError {
|
||||
fn is_eq(&self, other: &dyn MersData) -> bool {
|
||||
@@ -116,6 +116,9 @@ impl MersType for RunCommandErrorT {
|
||||
fn is_included_in_single(&self, target: &dyn MersType) -> bool {
|
||||
self.is_same_type_as(target)
|
||||
}
|
||||
fn subtypes(&self, acc: &mut Type) {
|
||||
acc.add(Arc::new(self.clone()));
|
||||
}
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
||||
@@ -247,6 +247,10 @@ impl MersType for IterT {
|
||||
false
|
||||
}
|
||||
}
|
||||
fn subtypes(&self, acc: &mut Type) {
|
||||
// NOTE: This might not be good enough
|
||||
acc.add(Arc::new(self.clone()));
|
||||
}
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
||||
@@ -201,6 +201,11 @@ impl MersType for ListT {
|
||||
fn is_included_in_single(&self, target: &dyn MersType) -> bool {
|
||||
self.is_same_type_as(target)
|
||||
}
|
||||
fn subtypes(&self, acc: &mut Type) {
|
||||
for t in self.0.subtypes_type().types {
|
||||
acc.add(Arc::new(Self(Type::newm(vec![t]))));
|
||||
}
|
||||
}
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
||||
@@ -127,6 +127,11 @@ impl MersType for ThreadT {
|
||||
false
|
||||
}
|
||||
}
|
||||
fn subtypes(&self, acc: &mut Type) {
|
||||
for t in self.0.subtypes_type().types {
|
||||
acc.add(Arc::new(Self(Type::newm(vec![t]))));
|
||||
}
|
||||
}
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user