From bf69daa3bc7662638cadfbca6599a7f30d42aa72 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Tue, 29 Jun 2021 16:11:20 +0200 Subject: [PATCH] more type tooltip tests --- compiler/mono/src/alias_analysis.rs | 4 ++-- compiler/types/src/pretty_print.rs | 2 +- editor/src/editor/mvc/ed_update.rs | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/compiler/mono/src/alias_analysis.rs b/compiler/mono/src/alias_analysis.rs index ebd467954d..2b4354d26e 100644 --- a/compiler/mono/src/alias_analysis.rs +++ b/compiler/mono/src/alias_analysis.rs @@ -166,9 +166,9 @@ where p.build()? }; - /*if DEBUG { + if DEBUG { eprintln!("{}", program.to_source_string()); - }*/ + } morphic_lib::solve(program) } diff --git a/compiler/types/src/pretty_print.rs b/compiler/types/src/pretty_print.rs index fe58c39848..8df08669d1 100644 --- a/compiler/types/src/pretty_print.rs +++ b/compiler/types/src/pretty_print.rs @@ -355,7 +355,7 @@ fn write_content(env: &Env, content: Content, subs: &Subs, buf: &mut String, par fn write_flat_type(env: &Env, flat_type: FlatType, subs: &Subs, buf: &mut String, parens: Parens) { use crate::subs::FlatType::*; - + match flat_type { Apply(symbol, args) => write_apply(env, symbol, args, subs, buf, parens), EmptyRecord => buf.push_str(EMPTY_RECORD), diff --git a/editor/src/editor/mvc/ed_update.rs b/editor/src/editor/mvc/ed_update.rs index e0ad11da87..9e19802dd8 100644 --- a/editor/src/editor/mvc/ed_update.rs +++ b/editor/src/editor/mvc/ed_update.rs @@ -1930,7 +1930,12 @@ pub mod test_ed_update { )?; assert_type_tooltip(&["┃"], "List *", '[')?; - + assert_type_tooltips_seq(&["┃"], &vec!["List (Num *)"], "[0")?; + assert_type_tooltips_seq(&["┃"], &vec!["List (Num *)", "List (List (Num *))"], "[[0")?; + assert_type_tooltips_seq(&["┃"], &vec!["Str", "List Str"], "[\"a")?; + assert_type_tooltips_seq(&["┃"], &vec!["Str", "List Str", "List (List Str)", "List (List (List Str))"], "[[[\"a")?; + assert_type_tooltips_seq(&["┃"], &vec!["{ a : Num * }", "List { a : Num * }", "List (List { a : Num * })"], "[[{a:1")?; + Ok(()) }