Add type alias for String

This commit is contained in:
Richard Feldman 2019-09-01 00:51:22 -04:00
parent 04595a9e71
commit f95aa1c394
2 changed files with 15 additions and 13 deletions

View file

@ -47,7 +47,9 @@ fn write_apply(module_name: String, type_name: String, args: Vec<Variable>, subs
let write_parens = use_parens && !args.is_empty(); let write_parens = use_parens && !args.is_empty();
// Hardcoded type aliases // Hardcoded type aliases
if module_name == "Num" && type_name == "Num" { if module_name == "String" && type_name == "String" {
buf.push_str("String");
} else if module_name == "Num" && type_name == "Num" {
let arg = args.into_iter().next().unwrap_or_else(|| { let arg = args.into_iter().next().unwrap_or_else(|| {
panic!("Num did not have any type parameters somehow.") panic!("Num did not have any type parameters somehow.")
}); });

View file

@ -88,7 +88,7 @@ mod test_infer {
indoc!(r#" indoc!(r#"
"type inference!" "type inference!"
"#), "#),
"String.String" "String"
); );
} }
@ -98,7 +98,7 @@ mod test_infer {
indoc!(r#" indoc!(r#"
"" ""
"#), "#),
"String.String" "String"
); );
} }
@ -192,7 +192,7 @@ mod test_infer {
indoc!(r#" indoc!(r#"
[ "cowabunga" ] [ "cowabunga" ]
"#), "#),
"List String.String" "List String"
); );
} }
@ -202,7 +202,7 @@ mod test_infer {
indoc!(r#" indoc!(r#"
[[[ "foo" ]]] [[[ "foo" ]]]
"#), "#),
"List (List (List String.String))" "List (List (List String))"
); );
} }
@ -212,7 +212,7 @@ mod test_infer {
indoc!(r#" indoc!(r#"
[ "foo", "bar" ] [ "foo", "bar" ]
"#), "#),
"List String.String" "List String"
); );
} }
@ -226,7 +226,7 @@ mod test_infer {
"type inference is \(whatItIs)!" "type inference is \(whatItIs)!"
"#), "#),
"String.String" "String"
); );
} }
@ -291,7 +291,7 @@ mod test_infer {
indoc!(r#" indoc!(r#"
\_ _ _ -> "test!" \_ _ _ -> "test!"
"#), "#),
"*, *, * -> String.String" "*, *, * -> String"
); );
} }
@ -317,7 +317,7 @@ mod test_infer {
str str
"#), "#),
"String.String" "String"
); );
} }
@ -353,7 +353,7 @@ mod test_infer {
f f
"#), "#),
"*, *, * -> String.String" "*, *, * -> String"
); );
} }
@ -367,7 +367,7 @@ mod test_infer {
b b
"#), "#),
"*, *, * -> String.String" "*, *, * -> String"
); );
} }
@ -381,7 +381,7 @@ mod test_infer {
b b
"#), "#),
"String.String" "String"
); );
} }
@ -441,7 +441,7 @@ mod test_infer {
// alwaysFoo 42 // alwaysFoo 42
// "#), // "#),
// "String.String" // "String"
// ); // );
// } // }