From 23f8eb62a891748f403ad21187f5bee5fbb68c05 Mon Sep 17 00:00:00 2001 From: rvcas Date: Thu, 15 Apr 2021 21:42:06 -0400 Subject: [PATCH] feat(Expr2): constrain empty record --- editor/src/lang/constrain.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/editor/src/lang/constrain.rs b/editor/src/lang/constrain.rs index 22af7b2e6a..0e0e193120 100644 --- a/editor/src/lang/constrain.rs +++ b/editor/src/lang/constrain.rs @@ -18,11 +18,17 @@ pub enum Constraint { // And(Vec), } -pub fn constrain_expr(env: &mut Env, expr: &Expr2, expected: Expected) -> Constraint { +pub fn constrain_expr( + env: &mut Env, + expr: &Expr2, + expected: Expected, + region: Region, +) -> Constraint { use Constraint::*; match expr { - Expr2::Str(_) => Eq(str_type(env.pool), expected, Category::Str, Region::zero()), + Expr2::EmptyRecord => Eq(Type2::EmptyRec, expected, Category::Record, region), + Expr2::Str(_) => Eq(str_type(env.pool), expected, Category::Str, region), _ => todo!("implement constaints for {:?}", expr), } }