fix bug where subtypes of list didn't include type of empty list

This commit is contained in:
Mark 2024-01-16 12:00:16 +01:00
parent 2d373d1ba7
commit 9fe981fc6c
3 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "mers" name = "mers"
version = "0.3.2" version = "0.3.3"
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"
@ -11,6 +11,6 @@ repository = "https://github.com/Dummi26/mers"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
mers_lib = "0.3.2" mers_lib = "0.3.3"
# mers_lib = { path = "../mers_lib", features = ["parse"] } # mers_lib = { path = "../mers_lib", features = ["parse"] }
clap = { version = "4.3.19", features = ["derive"] } clap = { version = "4.3.19", features = ["derive"] }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "mers_lib" name = "mers_lib"
version = "0.3.2" version = "0.3.3"
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

@ -299,6 +299,8 @@ impl MersType for ListT {
for t in self.0.subtypes_type().types { for t in self.0.subtypes_type().types {
acc.add(Arc::new(Self(Type::newm(vec![t])))); acc.add(Arc::new(Self(Type::newm(vec![t]))));
} }
// The type of an empty list is a list where the items are `<unreachable>`
acc.add(Arc::new(Self(Type::empty())));
} }
fn as_any(&self) -> &dyn std::any::Any { fn as_any(&self) -> &dyn std::any::Any {
self self