diff --git a/src/abstract_tree/value_node.rs b/src/abstract_tree/value_node.rs
index 149cef6..3da7b0b 100644
--- a/src/abstract_tree/value_node.rs
+++ b/src/abstract_tree/value_node.rs
@@ -88,13 +88,13 @@ impl AbstractTree for ValueNode {
ValueNode::Range(start..=end)
}
"enum_instance" => {
- let name_node = child.child(1).unwrap();
+ let name_node = child.child(0).unwrap();
let name = Identifier::from_syntax(name_node, source, context)?;
- let variant_node = child.child(3).unwrap();
+ let variant_node = child.child(2).unwrap();
let variant = Identifier::from_syntax(variant_node, source, context)?;
- let expression = if let Some(expression_node) = child.child(5) {
+ let expression = if let Some(expression_node) = child.child(4) {
Some(Box::new(Expression::from_syntax(expression_node, source, context)?))
} else {
None
diff --git a/tests/built_in_type_definitions.rs b/tests/built_in_type_definitions.rs
index 0ff3051..0edebc9 100644
--- a/tests/built_in_type_definitions.rs
+++ b/tests/built_in_type_definitions.rs
@@ -3,7 +3,7 @@ use dust_lang::*;
#[test]
fn option() {
assert_eq!(
- interpret("new Option:None"),
+ interpret("Option::None"),
Ok(Value::Enum(EnumInstance::new(
"Option".to_string(),
"None".to_string(),
@@ -13,7 +13,7 @@ fn option() {
assert_eq!(
interpret(
"
- opt