Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
2745-v3_core-Raise-clearer-exceptions-when-filt...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2745-v3_core-Raise-clearer-exceptions-when-filters-are-ba.patch of Package erlang
From 8e0fa46218bd32859627d49d5553027d29a98465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Tue, 24 Nov 2020 05:06:29 +0100 Subject: [PATCH 5/5] v3_core: Raise clearer exceptions when filters are bad Raise a `{bad_filter,Filter}` exception when a filter does not evaluate to a boolean. --- lib/compiler/src/v3_core.erl | 2 +- lib/compiler/test/lc_SUITE.erl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/compiler/src/v3_core.erl b/lib/compiler/src/v3_core.erl index 7b14e15b8c..fa54a14067 100644 --- a/lib/compiler/src/v3_core.erl +++ b/lib/compiler/src/v3_core.erl @@ -1526,7 +1526,7 @@ filter_tq(Line, E, #ifilter{anno=#a{anno=LA}=LAnno,arg={Pre,Arg}}, {Lc,Lps,St1} = TqFun(Line, E, Qs, Mc, St0), {FailPat,St2} = new_var(St1), Fc = fail_clause([FailPat], LA, - c_tuple([#c_literal{val=case_clause},FailPat])), + c_tuple([#c_literal{val=bad_filter},FailPat])), {#icase{anno=LAnno#a{anno=[list_comprehension|LA]},args=[Arg], clauses=[#iclause{anno=LAnno, pats=[#c_literal{val=true}],guard=[], diff --git a/lib/compiler/test/lc_SUITE.erl b/lib/compiler/test/lc_SUITE.erl index 47579145ef..b8921755e0 100644 --- a/lib/compiler/test/lc_SUITE.erl +++ b/lib/compiler/test/lc_SUITE.erl @@ -107,6 +107,7 @@ basic(Config) when is_list(Config) -> [] = [X || X <- L1, X+1 < 2], {'EXIT',_} = (catch [X || X <- L1, odd(X)]), {'EXIT',{{bad_generator,x},_}} = (catch [E || E <- id(x)]), + {'EXIT',{{bad_filter,not_bool},_}} = (catch [E || E <- [1,2], id(not_bool)]), %% Make sure that line numbers point out the generator. case ?MODULE of -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor