diff options
author | Hans Bolinder <[email protected]> | 2015-08-20 08:50:58 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2015-08-21 08:26:18 +0200 |
commit | 4732b2e14710cc6287df82ddcf1bb7d8777706a9 (patch) | |
tree | b3b9b80f9259639abd9fafba9245e9ca666f5e28 | |
parent | e3a5ad489d6e6cc190b609f8648b6af993c1b333 (diff) | |
download | otp-4732b2e14710cc6287df82ddcf1bb7d8777706a9.tar.gz otp-4732b2e14710cc6287df82ddcf1bb7d8777706a9.tar.bz2 otp-4732b2e14710cc6287df82ddcf1bb7d8777706a9.zip |
stdlib: fix a qlc bug introduced in 18.0
As pointed out by roowe, qlc does not handle errors in early compiler
(scanner, parser) well in OTP 18.0.
-rw-r--r-- | lib/stdlib/src/qlc_pt.erl | 8 | ||||
-rw-r--r-- | lib/stdlib/test/qlc_SUITE.erl | 15 |
2 files changed, 21 insertions, 2 deletions
diff --git a/lib/stdlib/src/qlc_pt.erl b/lib/stdlib/src/qlc_pt.erl index 4e81e2c2dd..9577d17a85 100644 --- a/lib/stdlib/src/qlc_pt.erl +++ b/lib/stdlib/src/qlc_pt.erl @@ -428,7 +428,13 @@ compile_errors(FormsNoShadows) -> end. compile_forms(Forms0, Options) -> - Forms = [F || F <- Forms0, element(1, F) =/= eof] ++ [{eof,anno0()}], + Exclude = fun(eof) -> true; + (warning) -> true; + (error) -> true; + (_) -> false + end, + Forms = ([F || F <- Forms0, not Exclude(element(1, F))] + ++ [{eof,anno0()}]), try case compile:noenv_forms(Forms, compile_options(Options)) of {ok, _ModName, Ws0} -> diff --git a/lib/stdlib/test/qlc_SUITE.erl b/lib/stdlib/test/qlc_SUITE.erl index 72216bfa0d..52fdb69b73 100644 --- a/lib/stdlib/test/qlc_SUITE.erl +++ b/lib/stdlib/test/qlc_SUITE.erl @@ -74,6 +74,7 @@ otp_5644/1, otp_5195/1, otp_6038_bug/1, otp_6359/1, otp_6562/1, otp_6590/1, otp_6673/1, otp_6964/1, otp_7114/1, otp_7238/1, otp_7232/1, otp_7552/1, otp_6674/1, otp_7714/1, otp_11758/1, + otp_12946/1, manpage/1, @@ -143,7 +144,7 @@ groups() -> {tickets, [], [otp_5644, otp_5195, otp_6038_bug, otp_6359, otp_6562, otp_6590, otp_6673, otp_6964, otp_7114, otp_7232, - otp_7238, otp_7552, otp_6674, otp_7714, otp_11758]}, + otp_7238, otp_7552, otp_6674, otp_7714, otp_11758, otp_12946]}, {compat, [], [backward, forward]}]. init_per_suite(Config) -> @@ -7154,6 +7155,18 @@ otp_6674(Config) when is_list(Config) -> ?line run(Config, Ts). +otp_12946(doc) -> + ["Syntax error."]; +otp_12946(suite) -> []; +otp_12946(Config) when is_list(Config) -> + Text = + <<"-export([init/0]). + init() -> + ok. + y">>, + {errors,[{4,erl_parse,_}],[]} = compile_file(Config, Text, []), + ok. + manpage(doc) -> "Examples from qlc(3)."; manpage(suite) -> []; |