Merge remote-tracking branch 'origin/trunk' into fix-comments

This commit is contained in:
Richard Feldman 2022-07-10 08:52:20 -04:00
commit c09fd5ea91
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798
3 changed files with 11 additions and 10 deletions

View file

@ -8958,6 +8958,7 @@ where
ToLowLevelCall: Fn(ToLowLevelCallArguments<'a>) -> Call<'a> + Copy, ToLowLevelCall: Fn(ToLowLevelCallArguments<'a>) -> Call<'a> + Copy,
{ {
match lambda_set.runtime_representation() { match lambda_set.runtime_representation() {
Layout::VOID => empty_lambda_set_error(),
Layout::Union(union_layout) => { Layout::Union(union_layout) => {
let closure_tag_id_symbol = env.unique_symbol(); let closure_tag_id_symbol = env.unique_symbol();
@ -9117,6 +9118,11 @@ where
} }
} }
fn empty_lambda_set_error() -> Stmt<'static> {
let msg = "a Lambda Set is empty. Most likely there is a type error in your program.";
Stmt::RuntimeError(msg)
}
/// Use the lambda set to figure out how to make a call-by-name /// Use the lambda set to figure out how to make a call-by-name
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
fn match_on_lambda_set<'a>( fn match_on_lambda_set<'a>(
@ -9131,6 +9137,7 @@ fn match_on_lambda_set<'a>(
hole: &'a Stmt<'a>, hole: &'a Stmt<'a>,
) -> Stmt<'a> { ) -> Stmt<'a> {
match lambda_set.runtime_representation() { match lambda_set.runtime_representation() {
Layout::VOID => empty_lambda_set_error(),
Layout::Union(union_layout) => { Layout::Union(union_layout) => {
let closure_tag_id_symbol = env.unique_symbol(); let closure_tag_id_symbol = env.unique_symbol();
@ -9260,9 +9267,7 @@ fn union_lambda_set_to_switch<'a>(
// there is really nothing we can do here. We generate a runtime error here which allows // there is really nothing we can do here. We generate a runtime error here which allows
// code gen to proceed. We then assume that we hit another (more descriptive) error before // code gen to proceed. We then assume that we hit another (more descriptive) error before
// hitting this one // hitting this one
return empty_lambda_set_error();
let msg = "a Lambda Set isempty. Most likely there is a type error in your program.";
return Stmt::RuntimeError(msg);
} }
let join_point_id = JoinPointId(env.unique_symbol()); let join_point_id = JoinPointId(env.unique_symbol());

View file

@ -5,14 +5,10 @@ procedure List.5 (#Attr.2, #Attr.3):
procedure Test.2 (Test.3): procedure Test.2 (Test.3):
let Test.7 : {} = Struct {}; let Test.7 : {} = Struct {};
let Test.6 : {} = CallByName Test.8 Test.7; Error a Lambda Set is empty. Most likely there is a type error in your program.
ret Test.6;
procedure Test.8 (Test.9):
Error The `#UserApp.IdentId(8)` function could not be generated, likely due to a type error.
procedure Test.0 (): procedure Test.0 ():
let Test.1 : List {} = Array []; let Test.1 : List [] = Array [];
let Test.5 : {} = Struct {}; let Test.5 : {} = Struct {};
let Test.4 : List {} = CallByName List.5 Test.1 Test.5; let Test.4 : List {} = CallByName List.5 Test.1 Test.5;
ret Test.4; ret Test.4;

View file

@ -2,5 +2,5 @@ procedure List.5 (#Attr.2, #Attr.3):
Error UnresolvedTypeVar crates/compiler/mono/src/ir.rs line 5035 Error UnresolvedTypeVar crates/compiler/mono/src/ir.rs line 5035
procedure Test.0 (): procedure Test.0 ():
let Test.1 : List {} = Array []; let Test.1 : List [] = Array [];
Error UnresolvedTypeVar crates/compiler/mono/src/ir.rs line 4562 Error UnresolvedTypeVar crates/compiler/mono/src/ir.rs line 4562