diff --git a/README.md b/README.md index 2833611..bfc81ac 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,8 @@ let c = b + "world" ``` **dates and time** -Create a date literal with + +Create a date with a literal: ``` let d:date = d"1979-12-16 16:12:19.000 +01:00" ``` diff --git a/src/compiler_tests.rs b/src/compiler_tests.rs index d5ce06d..39246a1 100644 --- a/src/compiler_tests.rs +++ b/src/compiler_tests.rs @@ -37,7 +37,7 @@ mod tests { #[test] fn index_in_list_literal() { - assert_eq!(run(r#"["abc","def"][0]"#), Ok(Value::String("abc".into()))) + assert_eq!(run(r#"["abc","def"][1]"#), Ok(Value::String("def".into()))) } #[test] diff --git a/src/vm.rs b/src/vm.rs index a475b92..fab689a 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -193,7 +193,7 @@ impl Vm { OP_LIST_GET => { let index_high = self.read(chunk); let index_low = self.read(chunk); - let index = index_high <<16 + index_low; + let index = (index_high <<16) + index_low; let list = self.pop(); if let Value::List(list) = list { self.push(list.get(index).cloned().unwrap())