Tests compile again
This commit is contained in:
parent
ea542192be
commit
9a28ccfd85
@ -9,7 +9,7 @@ pub use operators::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Meta<T> {
|
||||
n: T,
|
||||
pub n: T,
|
||||
source_map: SourceMap,
|
||||
type_data: TypeData,
|
||||
pub fqsn: Option<FullyQualifiedSymbolName>
|
||||
|
@ -937,14 +937,14 @@ impl Parser {
|
||||
match self.token_handler.peek_kind() {
|
||||
LCurlyBrace => {
|
||||
let members = delimited!(self, LCurlyBrace, record_pattern_entry, Comma, RCurlyBrace);
|
||||
Pattern::Record(qualified_name, members)
|
||||
Pattern::Record(Meta::new(qualified_name), members)
|
||||
},
|
||||
LParen => {
|
||||
let members = delimited!(self, LParen, pattern, Comma, RParen);
|
||||
Pattern::TupleStruct(qualified_name, members)
|
||||
Pattern::TupleStruct(Meta::new(qualified_name), members)
|
||||
},
|
||||
_ => {
|
||||
Pattern::VarOrName(qualified_name)
|
||||
Pattern::VarOrName(Meta::new(qualified_name))
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -596,8 +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(QualifiedName(vec![rc!(Some)]),
|
||||
vec![Pattern::VarOrName(QualifiedName(vec![rc!(a)]))]), vec![exst!(s "4")], Some(vec![exst!(s "9")]))) }
|
||||
body: bx!(IfExpressionBody::SimplePatternMatch(Pattern::TupleStruct(Meta::new(QualifiedName(vec![rc!(Some)])),
|
||||
vec![Pattern::VarOrName(Meta::new(QualifiedName(vec![rc!(a)])))]), vec![exst!(s "4")], Some(vec![exst!(s "9")]))) }
|
||||
)
|
||||
}
|
||||
|
||||
@ -605,8 +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(QualifiedName(vec![rc!(Some)]),
|
||||
vec![Pattern::VarOrName(QualifiedName(vec![rc!(a)]))]), vec![exst!(s "4")], Some(vec![exst!(s "9")]))) }
|
||||
body: bx!(IfExpressionBody::SimplePatternMatch(Pattern::TupleStruct(Meta::new(QualifiedName(vec![rc!(Some)])),
|
||||
vec![Pattern::VarOrName(Meta::new(QualifiedName(vec![rc!(a)])))]), vec![exst!(s "4")], Some(vec![exst!(s "9")]))) }
|
||||
)
|
||||
}
|
||||
|
||||
@ -615,9 +615,9 @@ fn patterns() {
|
||||
IfExpression {
|
||||
discriminator: bx!(Discriminator::Simple(Meta::new(ex!(s "x")))),
|
||||
body: bx!(IfExpressionBody::SimplePatternMatch(
|
||||
Pattern::Record(QualifiedName(vec![rc!(Something)]), vec![
|
||||
Pattern::Record(Meta::new(QualifiedName(vec![rc!(Something)])), vec![
|
||||
(rc!(a),Pattern::Literal(PatternLiteral::StringPattern(rc!(a)))),
|
||||
(rc!(b),Pattern::VarOrName(QualifiedName(vec![rc!(x)])))
|
||||
(rc!(b),Pattern::VarOrName(Meta::new(QualifiedName(vec![rc!(x)]))))
|
||||
]),
|
||||
vec![exst!(s "4")], Some(vec![exst!(s "9")])))
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ fn reduce_if_expression(discriminator: &Discriminator, body: &IfExpressionBody,
|
||||
};
|
||||
|
||||
let alternatives = vec![
|
||||
pat.node().to_alternative(then_clause, symbol_table),
|
||||
pat.to_alternative(then_clause, symbol_table),
|
||||
Alternative {
|
||||
matchable: Subpattern {
|
||||
tag: None,
|
||||
@ -272,7 +272,7 @@ fn reduce_if_expression(discriminator: &Discriminator, body: &IfExpressionBody,
|
||||
match arm.guard {
|
||||
Guard::Pat(ref p) => {
|
||||
let item = reduce_block(&arm.body, symbol_table);
|
||||
let alt = p.node().to_alternative(item, symbol_table);
|
||||
let alt = p.to_alternative(item, symbol_table);
|
||||
alternatives.push(alt);
|
||||
},
|
||||
Guard::HalfExpr(HalfExpr { op: _, expr: _ }) => {
|
||||
@ -346,7 +346,7 @@ impl Pattern {
|
||||
fn to_subpattern(&self, symbol_table: &SymbolTable) -> Subpattern {
|
||||
use self::Pattern::*;
|
||||
match self {
|
||||
TupleStruct(QualifiedName(vec), inner_patterns) => {
|
||||
TupleStruct( Meta { n: QualifiedName(vec), .. }, inner_patterns) => {
|
||||
let name = if vec.len() == 1 {
|
||||
vec[0].clone()
|
||||
} else {
|
||||
@ -361,7 +361,7 @@ impl Pattern {
|
||||
},
|
||||
Ignored => Subpattern { tag: None, subpatterns: vec![], guard: None, bound_vars: vec![] },
|
||||
Literal(lit) => lit.to_subpattern(symbol_table),
|
||||
VarOrName(QualifiedName(vec)) => {
|
||||
VarOrName(Meta { n: QualifiedName(vec), .. }) => {
|
||||
//TODO this name needs to be resolved from metadata with context
|
||||
let name = if vec.len() == 1 {
|
||||
vec[0].clone()
|
||||
|
Loading…
Reference in New Issue
Block a user