diff --git a/src/pretty_print_types.rs b/src/pretty_print_types.rs index cf403ead8a..684de0789f 100644 --- a/src/pretty_print_types.rs +++ b/src/pretty_print_types.rs @@ -70,6 +70,9 @@ fn write_flat_type(flat_type: FlatType, subs: &mut Subs, buf: &mut String, use_p if use_parens { buf.push_str(")"); } + }, + Erroneous(problem) => { + buf.push_str(&format!("", problem)); } } } diff --git a/src/solve.rs b/src/solve.rs index 882ec741be..390f799495 100644 --- a/src/solve.rs +++ b/src/solve.rs @@ -106,16 +106,11 @@ fn type_to_variable(subs: &mut Subs, typ: Type) -> Variable { subs.fresh(Descriptor::from(content)) }, - _ => panic!("TODO type_to_var {:?}", typ) + Erroneous(problem) => { + let content = Content::Structure(FlatType::Erroneous(problem)); - // AppN home name args -> - // do argVars <- traverse go args - // register rank pools (Structure (App1 home name argVars)) - - // FunN a b -> - // do aVar <- go a - // bVar <- go b - // register rank pools (Structure (Fun1 aVar bVar)) + subs.fresh(Descriptor::from(content)) + } } } diff --git a/src/subs.rs b/src/subs.rs index fc6eb595d6..7eb07cfcbb 100644 --- a/src/subs.rs +++ b/src/subs.rs @@ -1,7 +1,9 @@ use ena::unify::{UnificationTable, UnifyKey, InPlace}; use std::fmt; +use types::Problem; use unify; +#[derive(Debug)] pub struct Subs { utable: UnificationTable> } @@ -141,6 +143,7 @@ pub enum Content { pub enum FlatType { Apply(String /* module name */, String /* type name */, Vec), Func(Vec, Variable), + Erroneous(Problem), EmptyRecord, } diff --git a/src/types.rs b/src/types.rs index d44b77a7b8..9ccc78f478 100644 --- a/src/types.rs +++ b/src/types.rs @@ -15,8 +15,6 @@ pub enum Type { /// Applying a type to some arguments (e.g. Map.Map String Int) Apply(ModuleName, String, Vec), Variable(Variable), - /// A Blank in the editor (a "typed hole" as they're also known) - Blank, /// A type error, which will code gen to a runtime error Erroneous(Problem), }