Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

In a 'unit module', a 'die' along any CATCH block causes a compiler error #6425

Open p6rt opened 7 years ago

p6rt commented 7 years ago

Migrated from rt.perl.org#131841 (status was 'open')

Searchable as RT131841$

p6rt commented 7 years ago

From darek.cidlinsky@atlas.cz

A minimal example​:   echo 'unit module Foo; die; CATCH { }' > Foo.pm6; perl6 -I. -MFoo -e '' That fails with a   ===SORRY!===   Cannot invoke this object (REPR​: Null; VMNull)

With a --ll-exception switch, it yields   Unhandled exception​: concatenate requires a concrete string, but got null   at gen/moar/stage2/NQPCORE.setting​:840 (...path...)   from gen/moar/stage2/NQPHLL.nqp​:1735 (...)   from src/Perl6/Compiler.nqp​:42 (...)   (...)

The same happens even if we catch the exception (and probably no matter what the CATCH block does)​:   echo 'unit module Foo; die; CATCH { default { .say } }' > Foo.pm6; perl6 -I. -MFoo -e '' And it happens no matter what the type of the exception is​:   echo 'unit module Foo; X​::Proc​::Unsuccessful.new.throw; CATCH { default { .say } }' > Foo.pm6; perl6 -I. -MFoo -e ''

On the other hand, if we use 'module Foo { }' or try it in a script, everything works OK​:   perl6 -e 'die; CATCH { }'   echo 'module Foo { die; CATCH { } }' > Foo.pm6; perl6 -I. -MFoo -e ''

D.

p6rt commented 7 years ago

From darek.cidlinsky@atlas.cz

It should be added that this bugreport pertains to the version 2017.07​:

  This is Rakudo version 2017.07 built on MoarVM version 2017.07   implementing Perl 6.c.

D.

p6rt commented 7 years ago

From @timo

Annoyingly, 2017.07 has a bug that makes every --ll-exception print that exact error. Here's what a newer version of rakudo gives you​:

Cannot invoke this object (REPR​: Null; VMNull) at SETTING​::src/core/Exception.pm​:57 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:throw) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:81 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:79 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:) from \​:1 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:) from \​:1 (/tmp/.precomp/D9F3CABC797F4C68B8C92AB15C271BDDF8756DF0.1502129121.89224/20/201A6B3053CC1422D2C3670B62616221D2290929​:) from SETTING​::src/core/Exception.pm​:54 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:throw) from SETTING​::src/core/control.pm​:170 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:die) from SETTING​::src/core/control.pm​:166 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:die) from /tmp/Foo.pm6 (Foo)​:1 (/tmp/.precomp/D9F3CABC797F4C68B8C92AB15C271BDDF8756DF0.1502129121.89224/20/201A6B3053CC1422D2C3670B62616221D2290929​:) from /tmp/Foo.pm6 (Foo)​:1 (/tmp/.precomp/D9F3CABC797F4C68B8C92AB15C271BDDF8756DF0.1502129121.89224/20/201A6B3053CC1422D2C3670B62616221D2290929​:\) from /tmp/Foo.pm6 (Foo)​:1 (/tmp/.precomp/D9F3CABC797F4C68B8C92AB15C271BDDF8756DF0.1502129121.89224/20/201A6B3053CC1422D2C3670B62616221D2290929​:\<unit-outer>) from \​:1 (/tmp/.precomp/D9F3CABC797F4C68B8C92AB15C271BDDF8756DF0.1502129121.89224/20/201A6B3053CC1422D2C3670B62616221D2290929​:\) from SETTING​::src/core/CompUnit/Loader.pm​:50 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:load-precompilation-file) from SETTING​::src/core/CompUnit/Loader.pm​:33 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:load-precompilation-file) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:71 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:load-handle-for-path) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:195 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:191 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:load) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:166 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:load) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:46 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:try-load) from SETTING​::src/core/CompUnit/Repository/FileSystem.pm​:128 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:) from SETTING​::src/core/CompUnit/Repository/FileSystem.pm​:121 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:need) from src/Perl6/World.nqp​:1218 (/home/timo/perl6/install/share/nqp/lib/Perl6/World.moarvm​:load_module) from src/Perl6/World.nqp​:1148 (/home/timo/perl6/install/share/nqp/lib/Perl6/World.moarvm​:do_pragma_or_load_module) from src/Perl6/World.nqp​:616 (/home/timo/perl6/install/share/nqp/lib/Perl6/World.moarvm​:loading_and_symbol_setup) from src/Perl6/Grammar.nqp​:1188 (/home/timo/perl6/install/share/nqp/lib/Perl6/Grammar.moarvm​:comp_unit) from src/Perl6/Grammar.nqp​:495 (/home/timo/perl6/install/share/nqp/lib/Perl6/Grammar.moarvm​:TOP) from gen/moar/stage2/QRegex.nqp​:2324 (/home/timo/perl6/install/share/nqp/lib/QRegex.moarvm​:parse) from gen/moar/stage2/NQPHLL.nqp​:1935 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:parse) from gen/moar/stage2/NQPHLL.nqp​:1848 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:execute_stage) from gen/moar/stage2/NQPHLL.nqp​:1884 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:run) from gen/moar/stage2/NQPHLL.nqp​:1887 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:) from gen/moar/stage2/NQPHLL.nqp​:1873 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:compile) from gen/moar/stage2/NQPHLL.nqp​:1588 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:eval) from gen/moar/stage2/NQPHLL.nqp​:1713 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:) from gen/moar/stage2/NQPHLL.nqp​:1753 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:command_eval) from src/Perl6/Compiler.nqp​:42 (/home/timo/perl6/install/share/nqp/lib/Perl6/Compiler.moarvm​:command_eval) from gen/moar/stage2/NQPHLL.nqp​:1694 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:command_line) from gen/moar/main.nqp​:47 (/home/timo/perl6/install/share/perl6/runtime/perl6.moarvm​:MAIN) from gen/moar/main.nqp​:38 (/home/timo/perl6/install/share/perl6/runtime/perl6.moarvm​:\) from \​:1 (/home/timo/perl6/install/share/perl6/runtime/perl6.moarvm​:\

) from \​:1 (/home/timo/perl6/install/share/perl6/runtime/perl6.moarvm​:\)

This is Rakudo version 2017.07-137-g46ef1b5 built on MoarVM version 2017.07-346-g0fe5cd6

p6rt commented 7 years ago

The RT System itself - Status changed from 'new' to 'open'

p6rt commented 7 years ago

From darek.cidlinsky@atlas.cz

Aaah, that explains quite some things! Thank you for pointing it out.

D.

Die 07.08.2017, hora 11​:08, Timo Paulssen via RT hoc scripsit​:

Annoyingly, 2017.07 has a bug that makes every --ll-exception print that exact error. Here's what a newer version of rakudo gives you​:

Cannot invoke this object (REPR​: Null; VMNull) at SETTING​::src/core/Exception.pm​:57 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:throw) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:81 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:79 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:) from \​:1 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:) from \​:1 (/tmp/.precomp/D9F3CABC797F4C68B8C92AB15C271BDDF8756DF0.1502129121.89224/20/201A6B3053CC1422D2C3670B62616221D2290929​:) from SETTING​::src/core/Exception.pm​:54 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:throw) from SETTING​::src/core/control.pm​:170 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:die) from SETTING​::src/core/control.pm​:166 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:die) from /tmp/Foo.pm6 (Foo)​:1 (/tmp/.precomp/D9F3CABC797F4C68B8C92AB15C271BDDF8756DF0.1502129121.89224/20/201A6B3053CC1422D2C3670B62616221D2290929​:) from /tmp/Foo.pm6 (Foo)​:1 (/tmp/.precomp/D9F3CABC797F4C68B8C92AB15C271BDDF8756DF0.1502129121.89224/20/201A6B3053CC1422D2C3670B62616221D2290929​:\) from /tmp/Foo.pm6 (Foo)​:1 (/tmp/.precomp/D9F3CABC797F4C68B8C92AB15C271BDDF8756DF0.1502129121.89224/20/201A6B3053CC1422D2C3670B62616221D2290929​:\<unit-outer>) from \​:1 (/tmp/.precomp/D9F3CABC797F4C68B8C92AB15C271BDDF8756DF0.1502129121.89224/20/201A6B3053CC1422D2C3670B62616221D2290929​:\) from SETTING​::src/core/CompUnit/Loader.pm​:50 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:load-precompilation-file) from SETTING​::src/core/CompUnit/Loader.pm​:33 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:load-precompilation-file) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:71 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:load-handle-for-path) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:195 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:191 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:load) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:166 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:load) from SETTING​::src/core/CompUnit/PrecompilationRepository.pm​:46 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:try-load) from SETTING​::src/core/CompUnit/Repository/FileSystem.pm​:128 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:) from SETTING​::src/core/CompUnit/Repository/FileSystem.pm​:121 (/home/timo/perl6/install/share/perl6/runtime/CORE.setting.moarvm​:need) from src/Perl6/World.nqp​:1218 (/home/timo/perl6/install/share/nqp/lib/Perl6/World.moarvm​:load_module) from src/Perl6/World.nqp​:1148 (/home/timo/perl6/install/share/nqp/lib/Perl6/World.moarvm​:do_pragma_or_load_module) from src/Perl6/World.nqp​:616 (/home/timo/perl6/install/share/nqp/lib/Perl6/World.moarvm​:loading_and_symbol_setup) from src/Perl6/Grammar.nqp​:1188 (/home/timo/perl6/install/share/nqp/lib/Perl6/Grammar.moarvm​:comp_unit) from src/Perl6/Grammar.nqp​:495 (/home/timo/perl6/install/share/nqp/lib/Perl6/Grammar.moarvm​:TOP) from gen/moar/stage2/QRegex.nqp​:2324 (/home/timo/perl6/install/share/nqp/lib/QRegex.moarvm​:parse) from gen/moar/stage2/NQPHLL.nqp​:1935 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:parse) from gen/moar/stage2/NQPHLL.nqp​:1848 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:execute_stage) from gen/moar/stage2/NQPHLL.nqp​:1884 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:run) from gen/moar/stage2/NQPHLL.nqp​:1887 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:) from gen/moar/stage2/NQPHLL.nqp​:1873 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:compile) from gen/moar/stage2/NQPHLL.nqp​:1588 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:eval) from gen/moar/stage2/NQPHLL.nqp​:1713 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:) from gen/moar/stage2/NQPHLL.nqp​:1753 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:command_eval) from src/Perl6/Compiler.nqp​:42 (/home/timo/perl6/install/share/nqp/lib/Perl6/Compiler.moarvm​:command_eval) from gen/moar/stage2/NQPHLL.nqp​:1694 (/home/timo/perl6/install/share/nqp/lib/NQPHLL.moarvm​:command_line) from gen/moar/main.nqp​:47 (/home/timo/perl6/install/share/perl6/runtime/perl6.moarvm​:MAIN) from gen/moar/main.nqp​:38 (/home/timo/perl6/install/share/perl6/runtime/perl6.moarvm​:\) from \​:1 (/home/timo/perl6/install/share/perl6/runtime/perl6.moarvm​:\

) from \​:1 (/home/timo/perl6/install/share/perl6/runtime/perl6.moarvm​:\)

This is Rakudo version 2017.07-137-g46ef1b5 built on MoarVM version 2017.07-346-g0fe5cd6

p6rt commented 7 years ago

From @zoffixznet

On Mon, 07 Aug 2017 11​:08​:07 -0700, timo wrote​:

Annoyingly, 2017.07 has a bug that makes every --ll-exception print that

Just for reference, if needed, it's possible to work around that bug by telling rakudo to use a custom exceptions handler​:

  cd $(mktemp -d)   mkdir Exceptions   echo 'class Exceptions​::Foo {   method process ($e) {   say "$e.message() $e.backtrace.full()";   False   }   }' > Exceptions/Foo.pm6

  RAKUDO_EXCEPTIONS_HANDLER=Foo perl6 -I. -MExceptions​::Foo -e '…'