Commit 332762ee authored by Daniel Dehennin's avatar Daniel Dehennin

New upstream version 2017.06

parent a3f5f0f7
......@@ -222,6 +222,10 @@ E: dagurval@pvv.ntnu.no
N: dagurval
E: dagurval@pvv.ntnu.no
N: Dan Miller
E: danielcliffordmiller@gmail.com
U: danielcliffordmiller
N: Dan Sugalski
U: dan
D: Architect emeritus (0.0.1-0.1.1)
......@@ -265,7 +269,7 @@ E: rightfold@gmail.com
N: Elizabeth Mattijsen
U: lizmat
E: liz@dijkmat.nl
E: liz@wenzperl.nl
N: Erik Johansen
E: perl6-git@uniejo.dk
......
......@@ -110,6 +110,7 @@ docs/announce/2017.04.2.md
docs/announce/2017.04.3.md
docs/announce/2017.04.md
docs/announce/2017.05.md
docs/announce/2017.06.md
docs/architecture.html
docs/architecture.svg
docs/ChangeLog
......@@ -142,7 +143,6 @@ lib/NativeCall.pm6
lib/NativeCall/Types.pm6
lib/newline.pm6
lib/Pod/To/Text.pm6
lib/TAP.pm6
lib/Test.pm6
LICENSE
MANIFEST
......@@ -226,6 +226,7 @@ src/core/HyperWorkBuffer.pm
src/core/Instant.pm
src/core/Int.pm
src/core/IO/ArgFiles.pm
src/core/IO/CatHandle.pm
src/core/IO/Handle.pm
src/core/IO/Notification.pm
src/core/io_operators.pm
......@@ -442,11 +443,11 @@ t/01-sanity/55-use-trace.t
t/01-sanity/98-test-deprecated.t
t/01-sanity/99-test-basic.t
t/02-rakudo/01-is_approx.t
t/02-rakudo/02-new-is-approx.t
t/02-rakudo/03-cmp-ok.t
t/02-rakudo/04-diag.t
t/02-rakudo/05-range-in-range.t
t/02-rakudo/06-is.t
t/02-rakudo/07-io-cathandle.t
t/02-rakudo/dump.t
t/02-rakudo/repl.t
t/02-rakudo/test-packages/CustomOps.pm6
......
......@@ -28,7 +28,9 @@ purpose.**
10. Leave IO::Path.Str as is, without any changes. [Discussion](https://github.com/zoffixznet/IOwesomeness/issues/20)
11. The change to [`IO::Handle.Supply(:bin)` arg handling](https://github.com/rakudo/rakudo/blob/nom/docs/2017-IO-Grant--Action-Plan.md#changes-to-supply-issue-for-discussion), change to `IO::Handle.lock` argument handling, and making `IO::Path.new-from-absolute-path` private is to be done in 6.c and not 6.d; the change were miscategorized.
12. Make all IO routines that throw fail instead. [Discussion](https://irclog.perlgeek.de/perl6-dev/2016-12-28#i_13814044)
13. The behaviour of [.is-absolute on Windows](https://github.com/rakudo/rakudo/blob/nom/docs/2017-IO-Grant--Action-Plan.md#make-iopathis-absolute-give-false-for--path-on-windows-issue-for-discussion) was decided to be left as is.
14. .child was left as is [the proposed secure version](https://github.com/rakudo/rakudo/blob/nom/docs/2017-IO-Grant--Action-Plan.md#make-iopathchild-fail-for-non-child-paths--add-iopathconcat-with-issue-for-discussion) is implemented and is commented out in Rakudo's source. It was decided to switch to it in 6.d. The `.concat-with` routine was eventually named `.add`
15. `IO::Cat` was eventually named `IO::CatHandle`
---------------------------
......
New in 2017.06:
+ Fixes:
+ Fixed incorrect auto-boxing to native candidates in multi dispatch [ccfa5e51]
+ `^Inf .elems` now fails instead of returning Inf [20310d7d]
+ Made IO::Handle.print/.put signature consistent [613bdcf8]
+ Made sure that Setty:U is treated like any type object [ad8fa552]
+ Fixed behaviour of set() `(<)` X.Set [e6506bfd]
+ Made sure VM.osname always returns lowercase string [122aca1c]
+ Fixed List.Capture with non-Str-key Pairs [5b25836f]
+ Fixed inconsistency in .Int on zero-denominator Rats [6dbe85ed]
+ Fixed crash in smartmatch of non-Numerics with Numeric [43b03fc6]
+ Fixed occasional Windows file permission issues with installation of modules [8ec4dc5b]
+ Fixed crash in `X` operator used with empty List [9494cbd3]
+ Fixed spurious warnings/crash with certain `=para` Pod blocks [5e339345][807d30c2]
+ Fixed output of `CArray[Pointer].^shortname` [1ed284e2]
+ Fixed crash in Test.pm6's bail-out when used before tests [cb827606]
+ Fixed object Hash -> Set coercion failing to consider values [160de7e6]
+ Fixed Seq.perl for containerized Seqs [b22383fe]
+ Fixed Proc::Async.new not slurping first positional [92c187d2]
+ Fixed Proc::Async.kill failing to kill sometimes [99421d4c]
+ Fixed hang in deepmap with Iterable type objects [252dbf3a]
+ Fixed crash when Junctioning empty array after .elems'ing it [aa368421]
+ Fixed crashes/LTA errors in Junction.new w/wrong args [61ecfd51]
+ Fixed `infix:<orelse>` calling .defined one too many times [77d3c546]
+ Made `fail` re-arm handled Failures given as arguments [64e898f9]
+ Fixed output of IO::Special.perl [7344a3d2]
+ Made IO::Handle.open with path '-'.IO properly handle non-default `$*OUT`/`$*ERR` [3755c0e7]
+ Fixed Promise.then to not lose dynamic variables [36bc4102]
+ Fixed allomorph smartmatching with Str values [8a0b7460]
+ Fixed IO::Path.extension with Range `:parts` when endpoints were excluded [8efffb1d]
+ Made coercion of lazy Iterable to Setty fail [211063c7]
+ Made Mixy/Baggy.new-from-pairs with a lazy Iterable fail [c9dfa840][e5719d6a]
+ Fixed byte.Range returning an incorrect range [af85d538]
+ Fixed edge-cases (e.g. Nan/Inf) in Mixy.roll [fb9e1a87]
+ Made sure that Mixy types only take Real values [7fa85682]
+ Fixed incorrect results in ignorecase+ignoremark regex matches [1ac7996a]
+ Fixed issues with `$*CWD` inside &indir when using relative paths [9151ebaa][326faed6]
+ Fixed crash with Seq:U.List [5c56e9e7]
+ Fixed various issues with Map `(<=)` Map [e1563a76]
+ Fixed various issues with Map `(<)` Map [b03d8044]
+ Fixed 4 cases of crashes with labeled `next` [3b67b4ac]
+ Made Proc.status/Numeric/Bool/exitcode/sink wait for Proc to be done [e4468c61]
+ Fixed Pair.perl with type-object components [c6b03c45]
+ Fixed bad shell quoting in Proc::Async on Windows [e9b30933]
+ Fixed crash when RAKUDO_MODULE_DEBUG was set to a non-numeric value [96e6b338]
+ Fixed Kernel.signals on OpenBSD [9435c14e]
+ Various improvements to warnings and error reporting [1c16bf2e][85bef661][e22508d4]
[b6694bd0][ec51e73f][f2fca0c8][f9403b3b][86fe766a][c81b7a4b][7cf01296][fb7dd8a4]
[7783fcab][9bf3ea3a][02614f64][e538cbc5][86c3d7aa][c2497234][b0a1b6c3][97298aca]
[69b1b6c8][5e037736][e824266f]
+ Additions:
+ Implemented IO::CatHandle [5227828a]
+ Implemented support for merged STDOUT/ERR output Proc and Proc::Async [ac31c5df][05d8b883]
+ Implemented Complex.cis [a243063c]
+ Implemented Failure.self [0a100825]
+ Implemented Any.Seq [5c56e9e7]
+ Improved consistently to have .Supply on a type object it as Supply [52d39576]
+ Slightly changed IO::Handle.encoding; Nil now means 'bin'
[95b4e5d5][27f09e9d][9c0362cb][51c73ba0]
+ Gave `(<=)` Baggy and Mixy semantics for Bags/Mixes [b1d83f9d]
+ Makde `use lib` accept IO::Path objects [3ff29d42]
+ Added IO::Socket.nl-out attribute [12d31e36]
+ Added Setty.pickpairs [e3695b16]
+ Added Str type constraints to IO::Spec::Win32 .join and .catpath [232cf190]
+ Made it possible to call &prompt with no args [0646d3fa]
+ Made IO::Socket::INET update localport if it binds on port 0 [bc98e671]
+ Improved support for Unicode properties `Prepend` and `Regional Indicator` [56e71d59]
+ Gave IO::Handle.read default value for size arg [b7150ae1][aa9516be]
+ Added default output for Mu.WHY [23d6d42d][cc4d9091]
+ Added support for binding to standard handles in Proc::Async [6b2967d7]
+ [JVM] Implemented Proc::Async [5154b620]
+ Removals:
+ Removed TAP.pm6 from core. Available as `TAP::Harness` in the ecosystem [ae891f93]
+ Removed all methods from IO::ArgFiles and made it a subclass of IO::CatHandle [f539a624]
+ Removed IO::Socket::INET.ins [75693b0b]
+ Removed NYI IO::Socket.poll method [cb404c43]
+ Efficiency:
+ Made Any (elem) Iterable:D between 1.3x and 110x faster [e65800a8]
+ Made `(<=)` and `(>=)` about 50x faster [32eb285f]
+ Made IO::Spec::Win32.catpath 47x faster [7d6fa739]
+ Made `(<)` and `(>)` about 40x faster [431ed4e3]
+ Made IO::Spec::Win32.join 26x faster [494659a1]
+ Made IO::Spec::Win32.splitdir 25x faster [2816ef71]
+ Made Map `(<=)` Map about 15x faster [0cb4df44]
+ Made Map `(<)` Map about 15x faster [f6f54dcf]
+ Made Str.subst(Str) without :g 14x faster [0331fb9d]
+ Made Setty.roll about 11x faster [e6192ca8]
+ Made IO::Spec::Unix.splitdir 7.7x faster [6ca702fa]
+ Made invocation of Proc.spawn and &run 4.6x faster [93524fb9]
+ Made SetHash.grab(N) about 3.5x faster [67292a1e]
+ Made SetHash.grabpairs(N) about 3.5x faster [0e9ee0d1]
+ Made invocation of Blob.decode() 2.7x faster [222b4083]
+ Made Baggy/Mixy.(hash|Hash) about 2.5x as fast (on a 26 elem Bag/Mix) [06cd0bc3]
+ Made Setty.roll(N) about 2x faster [18dd0741]
+ Made Setty.pick about 2x faster [10e9c8ba]
+ Made Set.new(@a) about 2x faster [b55a0f16]
+ Made Baggy.new(@a) about 2x faster [11f27a30]
+ Made SetHash.grab about 1.8x faster [d28540be]
+ Made Str:D (elem) Map:D 1.3x faster [b43303f2]
+ Made `$*KERNEL.signal` 64% faster, overall [79b8ab9d][01d948d2]
+ Made Iterable.Bag about 60% faster [f2876281]
+ Made Iterable.Mix(|Hash) about 40% faster [bba6de5f]
+ Made Setty.pick(N) about 30% faster [071c88cb]
+ Made StrDistance 25% faster [2e041b06][9185fa2c]
+ Made (Bag|Mix).AT-KEY about 10% faster [b43db636]
+ Made `infix:<∉>` about 10% faster [abfb52be]
+ Made Str.starts-with 8% faster [7ecb59dc]
+ Made .Set, .Bag, and .Mix coercers a few percent faster [8791b447][4139b96e][8c7e4e51]
+ Fixed lost optimization of for ^N {}; now its 3x faster [46b11f54]
+ Made &DYNAMIC about 1% faster [74242e55]
+ Made ^Inf marginally faster [446dc190]
+ Assorted internal improvements to CPU/memory use [2efd812c][07bff0e5][1369632f][2ac120ce]
[539415cf][5ebf307a][ed07b2c3][0104a439][a91a2e4d][bd292225][8ff980e7][7edf9da6][241d2925]
[7e8bac9b][3363c7b9][6f932687][e9b30933][51b63bf9][57553386][1171e67e]
+ Internal:
+ Refactored handle encoding. Non-binary read methods now throw when used
on handles in binary mode [41bb1372][b3cd299e]
+ Refactored socket encoding [8ee383e3]
+ Made syncronous IO to not use libuv [05f3e9a0]
+ Made syncronous sockets to not use libuv [6f202fbe]
+ Moved encoding and line ending bits to IO::Socket [d6fd2491]
+ Moved get and lines to IO::Socket role [9cec9408]
+ IO::Path.Int method removed; handled by Cool.Int now [d13d9c2e]
+ Re-implemented Proc in terms of Proc::Async [ac31c5df]
New in 2017.05:
+ Fixes:
+ Made Promise subclass-friendly [a61746fe][a7c23aa2]
......
This diff is collapsed.
......@@ -22,8 +22,7 @@ Note that we are trying very hard to ensure there are no backward
compatibility issues post Christmas. As such, we may end up delaying
some releases to ensure any compatibility issues are resolved.
2017-05-20 Rakudo #111 (Zoffix)
2017-06-17 Rakudo #112
2017-06-17 Rakudo #112 (Zoffix)
2017-07-15 Rakudo #113
2017-08-19 Rakudo #114
2017-09-16 Rakudo #115
......@@ -430,6 +429,7 @@ Previous releases were bundled as part of monthly Parrot releases.
2017-04-18 2017.04.1 (Zoffix)
2017-04-18 2017.04.2 (Zoffix)
2017-04-23 2017.04.3 (Zoffix)
2017-05-20 Rakudo #111 "2017.05" (Zoffix + NeuralAnomaly)
=head1 COPYRIGHT
......
......@@ -20,7 +20,7 @@ sub pod2text($pod) is export {
when Pod::Block::Declarator { declarator2text($pod) }
when Pod::Item { item2text($pod).indent(2) }
when Pod::FormattingCode { formatting2text($pod) }
when Positional { $pod.map({pod2text($_)}).join("\n\n")}
when Positional { .flat».&pod2text.grep(?*).join: "\n\n" }
when Pod::Block::Comment { '' }
when Pod::Config { '' }
default { $pod.Str }
......@@ -109,7 +109,7 @@ sub declarator2text($pod) {
sub signature2text($params) {
$params.elems ??
"(\n\t" ~ $params.map(&param2text).join("\n\t") ~ "\n)"
"(\n\t" ~ $params.map(&param2text).join("\n\t") ~ "\n)"
!! "()";
}
sub param2text($p) {
......@@ -130,14 +130,8 @@ sub formatting2text($pod) {
!! $text
}
sub twine2text($twine) {
return '' unless $twine.elems;
my $r = $twine[0];
for $twine[1..*] -> $f, $s {
$r ~= twine2text($f.contents);
$r ~= $s;
}
$r;
sub twine2text($_) {
.map({ when Pod::Block { twine2text .contents }; .&pod2text }).join
}
sub twrap($text is copy, :$wrap=75 ) {
......
This diff is collapsed.
......@@ -254,6 +254,7 @@ multi sub cmp-ok(Mu $got, $op, Mu $expected, $desc = '') is export {
}
sub bail-out ($desc?) is export {
_init_io() unless $output;
$output.put: join ' ', 'Bail out!', ($desc if $desc);
$done_testing_has_been_run = 1;
exit 255;
......
......@@ -827,7 +827,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
# Emit any worries. Note that unwanting $mainline can produce worries.
if @*WORRIES {
nqp::printfh(nqp::getstderr(), $*W.group_exception().gist());
stderr().print($*W.group_exception().gist());
}
if %*COMPILING<%?OPTIONS><p> { # also covers the -np case, like Perl 5
......@@ -1377,17 +1377,14 @@ class Perl6::Actions is HLL::Actions does STDActions {
unless $past.ann('past_block') {
$past := make_topic_block_ref($/, $past, migrate_stmt_id => $*STATEMENT_ID);
}
$past := QAST::Want.new(
QAST::Op.new(
my $fornode := QAST::Op.new(
:op<p6for>, :node($/),
$cond,
block_closure($past),
),
'v', QAST::Op.new(
:op<p6for>, :node($/),
$cond,
block_closure($past),
),
);
$past := QAST::Want.new(
$fornode,
'v', QAST::Op.new(:op<p6sink>, $fornode),
);
$past[2].sunk(1);
my $sinkee := $past[0];
......@@ -1422,9 +1419,17 @@ class Perl6::Actions is HLL::Actions does STDActions {
$code := subst($code, /\s+$/, ''); # chomp!
$past := QAST::Stmts.new(:node($/),
QAST::Op.new(
:op<sayfh>,
:op<writefh>,
QAST::Op.new(:op<getstderr>),
QAST::SVal.new(:value("$id ($file line $line)\n$code"))
QAST::Op.new(
:op('encode'),
QAST::SVal.new(:value("$id ($file line $line)\n$code\n")),
QAST::SVal.new(:value('utf8')),
QAST::Op.new(
:op('callmethod'), :name('new'),
QAST::WVal.new( :value($*W.find_symbol(['Blob'])) )
)
)
),
$past
);
......@@ -1759,17 +1764,14 @@ class Perl6::Actions is HLL::Actions does STDActions {
method statement_control:sym<for>($/) {
my $xblock := $<xblock>.ast;
my $past := QAST::Want.new(
QAST::Op.new(
:op<p6for>, :node($/),
$xblock[0],
block_closure($xblock[1]),
),
'v', QAST::Op.new(
my $fornode := QAST::Op.new(
:op<p6for>, :node($/),
$xblock[0],
block_closure($xblock[1]),
),
);
my $past := QAST::Want.new(
$fornode,
'v', QAST::Op.new(:op<p6sink>, $fornode),
);
if $*LABEL {
my $label := QAST::WVal.new( :value($*W.find_symbol([$*LABEL])), :named('label') );
......@@ -3914,7 +3916,16 @@ class Perl6::Actions is HLL::Actions does STDActions {
if $past.ann('placeholder_sig') {
$/.PRECURSOR.panic('Placeholder variables cannot be used in a method');
}
$past[1] := wrap_return_handler($past[1]);
if is_clearly_returnless($past) {
$past[1] := QAST::Op.new(
:op('p6decontrv'),
QAST::WVal.new( :value($*DECLARAND) ),
$past[1]);
$past[1] := wrap_return_type_check($past[1], $*DECLARAND);
}
else {
$past[1] := wrap_return_handler($past[1]);
}
}
$past.blocktype('declaration_static');
......@@ -4199,6 +4210,8 @@ class Perl6::Actions is HLL::Actions does STDActions {
nqp::istype($past, QAST::Op)
&& $past.op ne 'callmethod' # May be .return or similar
&& nqp::getcomp('QAST').operations.is_inlinable('perl6', $past.op) ||
# A QAST::Stmt node
nqp::istype($past, QAST::Stmt) ||
# Just a variable lookup.
nqp::istype($past, QAST::Var) ||
# Just a QAST::Want
......@@ -4218,27 +4231,24 @@ class Perl6::Actions is HLL::Actions does STDActions {
1;
}
# Only analyse things with a single simple statement.
if +$block[1].list == 1 && nqp::istype($block[1][0], QAST::Stmt) && +$block[1][0].list == 1 {
# Ensure there's no nested blocks.
for @($block[0]) {
if nqp::istype($_, QAST::Block) { return 0; }
if nqp::istype($_, QAST::Stmts) {
for @($_) {
if nqp::istype($_, QAST::Block) { return 0; }
}
# Ensure second node is QAST::Stmts.
return 0 unless nqp::istype($block[1], QAST::Stmts);
# Ensure there's no nested blocks.
for @($block[0]) {
if nqp::istype($_, QAST::Block) { return 0; }
if nqp::istype($_, QAST::Stmts) {
for @($_) {
if nqp::istype($_, QAST::Block) { return 0; }
}
}
# Ensure that the PAST is whitelisted things.
returnless_past($block[1][0][0])
}
elsif +$block[1].list == 1 && nqp::istype($block[1][0], QAST::WVal) {
1
}
else {
0
# Check the block content.
for @($block[1]) {
return 0 unless returnless_past($_);
}
return 1;
}
sub is_yada($/) {
......
......@@ -73,10 +73,10 @@ class Perl6::Compiler is HLL::Compiler {
my $repl-class := self.eval('REPL', :outer_ctx(nqp::null()), |%adverbs);
$p6repl := $repl-class.new(self, %adverbs);
my $stdin := nqp::getstdin();
my $stdin := stdin();
my $encoding := ~%adverbs<encoding>;
if $encoding && $encoding ne 'fixed_8' {
nqp::setencoding($stdin, $encoding);
$stdin.set-encoding($encoding);
}
$p6repl.repl-loop(:interactive(1), |%adverbs)
......
......@@ -4577,7 +4577,6 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
$lang.clone_braid_from(self);
my $meth := $cat eq 'infix' || $cat eq 'prefix' || $cat eq 'postfix' ?? $cat ~ 'ish' !! $cat;
$meth := 'term:sym<reduce>' if $cat eq 'prefix' && $op ~~ /^ \[ .* \] $ /;
# nqp::printfh(nqp::getstderr(), "$meth $op\n");
my $cursor := $lang."$meth"();
my $match := $cursor.MATCH;
if $cursor.pos == nqp::chars($op) && (
......@@ -4591,7 +4590,6 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
my $META := $match.ast;
$META := $META[0] unless $META.name;
$META.name('&METAOP_HYPER_POSTFIX') if $META.name eq '&METAOP_HYPER_POSTFIX_ARGS';
# nqp::printfh(nqp::getstderr(), $META.dump);
my $fun := $*W.compile_time_evaluate(self.MATCH,$META);
$*W.install_lexical_symbol($*W.cur_lexpad(),'&' ~ $categorical[0],$fun);
$fun.set_name($name);
......
......@@ -137,7 +137,7 @@ my class Binder {
my $PositionalBindFailover;
#?if moar
sub arity_fail($params, int $num_params, int $num_pos_args, int $too_many) {
sub arity_fail($params, int $num_params, int $num_pos_args, int $too_many, $lexpad) {
my str $error_prefix := $too_many ?? "Too many" !! "Too few";
my int $count;
my int $arity;
......@@ -165,14 +165,15 @@ my class Binder {
$param_i++;
}
my str $s := $arity == 1 ?? "" !! "s";
my str $routine := nqp::getcodeobj(nqp::ctxcode($lexpad)).name;
if $arity == $count {
return "$error_prefix positionals passed; expected $arity argument$s but got $num_pos_args";
return "$error_prefix positionals passed to '$routine'; expected $arity argument$s but got $num_pos_args";
} elsif $count < 0 {
return "$error_prefix positionals passed; expected at least $arity argument$s but got only $num_pos_args";
return "$error_prefix positionals passed to '$routine'; expected at least $arity argument$s but got only $num_pos_args";
} else {
my str $conj := $count == $arity+1 ?? "or" !! "to";
return "$error_prefix positionals passed; expected $arity $conj $count arguments but got $num_pos_args";
return "$error_prefix positionals passed to '$routine'; expected $arity $conj $count arguments but got $num_pos_args";
}
}
......@@ -812,7 +813,7 @@ my class Binder {
}
else {
if nqp::defined($error) {
$error[0] := arity_fail(@params, $num_params, $num_pos_args, 0);
$error[0] := arity_fail(@params, $num_params, $num_pos_args, 0, $lexpad);
}
return $BIND_RESULT_FAIL;
}
......@@ -868,7 +869,7 @@ my class Binder {
if $cur_pos_arg < $num_pos_args && !$suppress_arity_fail {
# Oh noes, too many positionals passed.
if nqp::defined($error) {
$error[0] := arity_fail(@params, $num_params, $num_pos_args, 1);
$error[0] := arity_fail(@params, $num_params, $num_pos_args, 1, $lexpad);
}
return $BIND_RESULT_FAIL;
}
......@@ -2566,7 +2567,6 @@ BEGIN {
my int $BIND_VAL_INT := 1;
my int $BIND_VAL_NUM := 2;
my int $BIND_VAL_STR := 3;
my int $ARG_IS_LITERAL := 32;
# Count arguments.
my int $num_args := nqp::elems(@args);
......@@ -2637,7 +2637,6 @@ BEGIN {
my $type_obj := nqp::atpos(nqp::atkey($cur_candidate, 'types'), $i);
my $type_flags := nqp::atpos_i(nqp::atkey($cur_candidate, 'type_flags'), $i);
my int $got_prim := nqp::atpos(@flags, $i) +& 0xF;
my int $literal := nqp::atpos(@flags, $i) +& $ARG_IS_LITERAL;
if $type_flags +& $TYPE_NATIVE_MASK {
# Looking for a natively typed value. Did we get one?
if $got_prim == $BIND_VAL_OBJ {
......@@ -2647,8 +2646,7 @@ BEGIN {
}
if (($type_flags +& $TYPE_NATIVE_INT) && $got_prim != $BIND_VAL_INT)
|| (($type_flags +& $TYPE_NATIVE_NUM) && $got_prim != $BIND_VAL_NUM)
|| (($type_flags +& $TYPE_NATIVE_STR) && $got_prim != $BIND_VAL_STR)
|| ($literal && nqp::atpos_i(nqp::atkey($cur_candidate, 'rwness'), $i)) {
|| (($type_flags +& $TYPE_NATIVE_STR) && $got_prim != $BIND_VAL_STR) {
# Mismatch.
$type_mismatch := 1;
$type_match_possible := 0;
......@@ -3319,18 +3317,17 @@ nqp::sethllconfig('perl6', nqp::hash(
}
},
'method_not_found_error', -> $obj, str $name {
my $type := $obj.HOW.name($obj);
if $name eq 'STORE' {
my %ex := nqp::gethllsym('perl6', 'P6EX');
if !nqp::isnull(%ex) && nqp::existskey(%ex,'X::Assignment::RO') {
nqp::atkey(%ex, 'X::Assignment::RO')($type);
nqp::atkey(%ex, 'X::Assignment::RO')($obj);
}
}
my %ex := nqp::gethllsym('perl6', 'P6EX');
if !nqp::isnull(%ex) && nqp::existskey(%ex,'X::Method::NotFound') {
nqp::atkey(%ex, 'X::Method::NotFound')($obj, $name, $type);
nqp::atkey(%ex, 'X::Method::NotFound')($obj, $name, $obj.HOW.name($obj));
}
nqp::die("Method '$name' not found for invocant of class '$type'");
nqp::die("Method '$name' not found for invocant of class '{$obj.HOW.name($obj)}'");
},
#?endif
'lexical_handler_not_found_error', -> int $cat, int $out_of_dyn_scope {
......
......@@ -3,9 +3,24 @@ role Perl6::Metamodel::Naming {
has $!shortname;
method set_name($obj, $name) {
$!name := $name;
my @parts := nqp::split('::', $name);
nqp::setdebugtypename($obj, $name);
$!shortname := @parts ?? @parts[nqp::elems(@parts) - 1] !! '';
if $name {
my @names := nqp::split('[', $name);
if nqp::elems(@names) > 1 {
my @main := nqp::split('::', @names[0]);
my @sub := nqp::split('::', @names[1]);
$!shortname :=
@main[nqp::elems(@main) - 1]
~ '[' ~ @sub[nqp::elems(@sub) - 1];
}
else {
my @parts := nqp::split('::', $name);
$!shortname := @parts[nqp::elems(@parts) - 1];
}
}
else {
$!shortname := '';
}
}
method set_shortname($obj, $shortname) {
$!shortname := $shortname;
......
my $DEBUG := +nqp::ifnull(nqp::atkey(nqp::getenvhash(), 'RAKUDO_MODULE_DEBUG'), 0);
# $DEBUG is set to 1 for Truey numeric values of ENV 'RAKUDO_MODULE_DEBUG'
# or for non-numeric strings. All other cases $DEBUG is set to 0
my $rakudo-module-debug := nqp::atkey(nqp::getenvhash(), 'RAKUDO_MODULE_DEBUG');
my $DEBUG := nqp::stmts((my $debug-radix := nqp::radix(10, $rakudo-module-debug, 0, 0)),($debug-radix[2] != -1))
?? ?$debug-radix[0] !! ?nqp::chars($rakudo-module-debug);
sub DEBUG(*@strs) {
my $err := nqp::getstderr();
nqp::printfh($err, " " ~ nqp::getpid() ~ " RMD: ");
for @strs { nqp::printfh($err, $_) };
nqp::printfh($err, "\n");
my $err := stderr();
$err.print(" " ~ nqp::getpid() ~ " RMD: ");
for @strs { $err.print($_) };
$err.print("\n");
1;
}
......
......@@ -391,11 +391,11 @@ my class Problems {
# We didn't die from any Exception, so we print warnings now.
if +%!worrying {
my $err := nqp::getstderr();
nqp::sayfh($err, "WARNINGS for " ~ $*W.current_file ~ ":");
my $err := stderr();
$err.say("WARNINGS for " ~ $*W.current_file ~ ":");
my @fails;
for %!worrying {
nqp::printfh($err, $_.key ~ " (line" ~ (+$_.value == 1 ?? ' ' !! 's ') ~
$err.print($_.key ~ " (line" ~ (+$_.value == 1 ?? ' ' !! 's ') ~
join(', ', $_.value) ~ ")\n");
}
}
......@@ -1066,7 +1066,7 @@ class Perl6::Optimizer {
# If it's a for 1..1000000 { } we can simplify it to a while loop. We
# check this here, before the tree is transformed by call inline opts.
if $optype eq 'p6for' && $op.sunk && @($op) == 2 {
if ($optype eq 'p6for' || $optype eq 'p6forstmt') && $op.sunk && @($op) == 2 {
my $theop := $op[0];
if nqp::istype($theop, QAST::Stmts) { $theop := $theop[0] }
......@@ -1712,7 +1712,7 @@ class Perl6::Optimizer {
else {
$!problems.add_exception(['X', 'Method', 'NotFound'], $op,
:private(nqp::p6bool(1)), :method($name),
:typename($pkg.HOW.name($pkg)));
:typename($pkg.HOW.name($pkg)), :invocant($pkg));
}
}
}
......@@ -1877,16 +1877,10 @@ class Perl6::Optimizer {
# Checks arguments to see if we're going to be able to do compile
# time analysis of the call.
my @allo_map := ['', 'Ii', 'Nn', 'Ss'];
my %allo_rev := nqp::hash('Ii', 1, 'Nn', 2, 'Ss', 3);
my @prim_names := ['', 'int', 'num', 'str'];
my int $ARG_IS_LITERAL := 32;
method analyze_args_for_ct_call($op) {
my @types;
my @flags;
my @allomorphs;
my int $num_prim := 0;
my int $num_allo := 0;
# Initial analysis.
for @($op) {
......@@ -1920,37 +1914,14 @@ class Perl6::Optimizer {
}
if $ok_type {
my $prim := nqp::objprimspec($type);
my str $allo := $_.has_compile_time_value && nqp::istype($_, QAST::Want)
?? $_[1] !! '';
@types.push($type);
@flags.push($prim);
@allomorphs.push($allo);
$num_prim := $num_prim + 1 if $prim;
$num_allo := $num_allo + 1 if $allo;
}
else {
return [];
}
}
# See if we have an allomorphic constant that may allow us to do
# a native dispatch with it; takes at least one declaratively
# native argument to make this happen.
if @types == 2 && $num_prim == 1 && $num_allo == 1 {
my int $prim_flag := @flags[0] || @flags[1];
my int $allo_idx := @allomorphs[0] ?? 0 !! 1;
if @allomorphs[$allo_idx] eq @allo_map[$prim_flag] {
@flags[$allo_idx] := $prim_flag +| $ARG_IS_LITERAL;
}
}
# Alternatively, a single arg that is allomorphic will prefer
# the literal too.
if @types == 1 && $num_allo == 1 {
my $rev := %allo_rev{@allomorphs[0]};
@flags[0] := nqp::defined($rev) ?? $rev +| $ARG_IS_LITERAL !! 0;
}
[@types, @flags]
}
......
......@@ -1038,8 +1038,11 @@ class Perl6::World is HLL::World {
}
if nqp::islist($arglist) {
my $registry := self.find_symbol(['CompUnit', 'RepositoryRegistry']);
my $io-path := self.find_symbol(['IO', 'Path']);
for $arglist -> $arg {
$registry.use-repository($registry.repository-for-spec($arg));
$registry.use-repository($registry.repository-for-spec(
nqp::istype($arg, $io-path) ?? $arg.absolute !! $arg
));
}
}
else {
......@@ -1682,7 +1685,10 @@ class Perl6::World is HLL::World {
}
else {
if @cont_type {
self.throw($/, 'X::NYI', :feature('is trait on $-sigil variable'));
self.throw($/, 'X::NYI',
:feature('is trait on $-sigil variable'),
:did-you-mean("my {@cont_type[0].HOW.name(@cont_type[0])} $sigil{~$<variable><desigilname>}")
);
}
%info<container_base> := self.find_symbol(['Scalar']);
%info<container_type> := %info<container_base>;
......@@ -4044,12 +4050,22 @@ class Perl6::World is HLL::World {
if $name eq '&length' {
@suggestions.push: $with_sigil ?? '&elems' !! 'elems';
@suggestions.push: $with_sigil ?? '&chars' !! 'chars';
@suggestions.push: $with_sigil ?? '&graphs' !! 'graphs';
@suggestions.push: $with_sigil ?? '&codes' !! 'codes';
}
elsif $name eq '&bytes' {
@suggestions.push: '.encode($encoding).bytes';
}
elsif $name eq '&break' {
@suggestions.push: 'last';
}
elsif $name eq '&skip' {
@suggestions.push: 'next';
}
elsif $name eq '&continue' {
@suggestions.push: 'NEXT';
@suggestions.push: 'proceed';
@suggestions.push: 'succeed';
}
return @suggestions;
}
......
......@@ -314,6 +314,7 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?"
$target.push(&!block($pulled)),
'LABELED', $!label,
'REDO', ($stopped = 0),
'NEXT', nqp::null, # need NEXT for next LABEL support
'LAST', return
)
),
......@@ -338,6 +339,7 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?"
&!block($pulled),
'LABELED', $!label,
'REDO', ($stopped = 0),
'NEXT', nqp::null, # need NEXT for next LABEL support
'LAST', return
)
),
......@@ -447,6 +449,7 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?"
'LABELED', $!label,