mirror of
https://github.com/Dummi26/mers.git
synced 2025-03-09 21:13:54 +01:00
fix initializing object from <unreachable> not working
This commit is contained in:
parent
6630542644
commit
e34d841f9a
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "mers"
|
||||
version = "0.9.17"
|
||||
version = "0.9.18"
|
||||
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.17"
|
||||
mers_lib = "0.9.18"
|
||||
# mers_lib = { path = "../mers_lib" }
|
||||
clap = { version = "4.3.19", features = ["derive"] }
|
||||
colored = { version = "2.1.0", optional = true }
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "mers_lib"
|
||||
version = "0.9.17"
|
||||
version = "0.9.18"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "library to use the mers language in other projects"
|
||||
|
@ -18,7 +18,9 @@ impl MersStatement for Object {
|
||||
info: &mut super::CheckInfo,
|
||||
init_to: Option<&Type>,
|
||||
) -> Result<data::Type, super::CheckError> {
|
||||
let mut init_to_is_empty_type = false;
|
||||
let mut init_fields = if let Some(init_to) = init_to {
|
||||
init_to_is_empty_type = init_to.types.is_empty();
|
||||
let print_is_part_of = init_to.types.len() > 1;
|
||||
let mut init_fields = HashMap::new();
|
||||
for t in init_to.types.iter() {
|
||||
@ -67,6 +69,8 @@ impl MersStatement for Object {
|
||||
if let Some(f) = &mut init_fields {
|
||||
Some(if let Some(s) = f.remove(field) {
|
||||
s
|
||||
} else if init_to_is_empty_type {
|
||||
Type::empty()
|
||||
} else {
|
||||
return Err(CheckError::new().msg(vec![
|
||||
("can't init an ".to_owned(), None),
|
||||
|
@ -4,7 +4,7 @@ version = "0.9.15"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
mers_lib = "0.9.14"
|
||||
mers_lib = "0.9.18"
|
||||
lspower = "1.5.0"
|
||||
tokio = { version = "1.36.0", features = ["full"] }
|
||||
line-span = "0.1.5"
|
||||
|
Loading…
Reference in New Issue
Block a user