From 2b5b1589b01b9f3c40728c9d0bb750d3e370d210 Mon Sep 17 00:00:00 2001 From: greg Date: Fri, 6 Sep 2019 02:30:18 -0700 Subject: [PATCH] tests compile, 15 fail --- schala-lang/language/src/parsing.rs | 3 +-- schala-lang/language/src/parsing/test.rs | 12 +++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/schala-lang/language/src/parsing.rs b/schala-lang/language/src/parsing.rs index 12a94da..71cdd8d 100644 --- a/schala-lang/language/src/parsing.rs +++ b/schala-lang/language/src/parsing.rs @@ -955,8 +955,7 @@ impl Parser { #[recursive_descent_method] fn pattern_literal(&mut self) -> ParseResult { let tok = self.token_handler.peek(); - let kind = tok.kind.clone(); - Ok(match kind { + Ok(match tok.get_kind() { Keyword(Kw::True) => { self.token_handler.next(); Pattern::Literal(PatternLiteral::BoolPattern(true)) diff --git a/schala-lang/language/src/parsing/test.rs b/schala-lang/language/src/parsing/test.rs index 592f57b..6bf3cde 100644 --- a/schala-lang/language/src/parsing/test.rs +++ b/schala-lang/language/src/parsing/test.rs @@ -596,7 +596,8 @@ fn patterns() { "if x is Some(a) then { 4 } else { 9 }", exst!( IfExpression { discriminator: bx!(Discriminator::Simple(Meta::new(ex!(s "x")))), - body: bx!(IfExpressionBody::SimplePatternMatch(Pattern::TupleStruct(rc!(Some), vec![Pattern::Literal(PatternLiteral::VarPattern(rc!(a)))]), vec![exst!(s "4")], Some(vec![exst!(s "9")]))) } + body: bx!(IfExpressionBody::SimplePatternMatch(Pattern::TupleStruct(QualifiedName(vec![rc!(Some)]), + vec![Pattern::VarOrName(QualifiedName(vec![rc!(a)]))]), vec![exst!(s "4")], Some(vec![exst!(s "9")]))) } ) } @@ -604,7 +605,8 @@ fn patterns() { "if x is Some(a) then 4 else 9", exst!( IfExpression { discriminator: bx!(Discriminator::Simple(Meta::new(ex!(s "x")))), - body: bx!(IfExpressionBody::SimplePatternMatch(Pattern::TupleStruct(rc!(Some), vec![Pattern::Literal(PatternLiteral::VarPattern(rc!(a)))]), vec![exst!(s "4")], Some(vec![exst!(s "9")]))) } + body: bx!(IfExpressionBody::SimplePatternMatch(Pattern::TupleStruct(QualifiedName(vec![rc!(Some)]), + vec![Pattern::VarOrName(QualifiedName(vec![rc!(a)]))]), vec![exst!(s "4")], Some(vec![exst!(s "9")]))) } ) } @@ -613,11 +615,11 @@ fn patterns() { IfExpression { discriminator: bx!(Discriminator::Simple(Meta::new(ex!(s "x")))), body: bx!(IfExpressionBody::SimplePatternMatch( - Pattern::Record(rc!(Something), vec![ + Pattern::Record(QualifiedName(vec![rc!(Something)]), vec![ (rc!(a),Pattern::Literal(PatternLiteral::StringPattern(rc!(a)))), - (rc!(b),Pattern::Literal(PatternLiteral::VarPattern(rc!(x)))) + (rc!(b),Pattern::VarOrName(QualifiedName(vec![rc!(x)]))) ]), - vec![exst!(s "4")], Some(vec![exst!(s "9")]))) + vec![exst!(s "4")], Some(vec![exst!(s "9")]))) } ) }