Commit 6fda6515 authored by Dominique Dumont's avatar Dominique Dumont

New upstream version 2016.11

parent 0d877604
......@@ -134,6 +134,13 @@ MAIN: {
$config{'runner_suffix'} = $win ? '.bat' : '';
my $make = 'make';
if ($^O eq 'solaris') {
if (not -X '/usr/bin/gmake') {
die "gmake is required to compile rakudo. Please install by 'pkg install gnu-make'";
}
$make = 'gmake';
}
if ($win) {
my $has_nmake = 0 == system('nmake /? >NUL 2>&1');
my $has_cl = `cl 2>&1` =~ /Microsoft Corporation/;
......@@ -151,7 +158,7 @@ MAIN: {
}
}
for my $target (qw/common_bootstrap_sources moar_core_sources/) {
for my $target (qw/common_bootstrap_sources moar_core_sources jvm_core_sources/) {
open my $FILELIST, '<', "tools/build/$target"
or die "Cannot read 'tools/build/$target': $!";
my @lines;
......
......@@ -99,6 +99,7 @@ docs/announce/2016.08.1.md
docs/announce/2016.08.md
docs/announce/2016.09.md
docs/announce/2016.10.md
docs/announce/2016.11.md
docs/architecture.html
docs/architecture.svg
docs/ChangeLog
......@@ -140,6 +141,7 @@ src/core/allomorphs.pm
src/core/Any-iterable-methods.pm
src/core/Any.pm
src/core/Argfiles.pm
src/core/array_operators.pm
src/core/Array.pm
src/core/array_slice.pm
src/core/Associative.pm
......@@ -245,6 +247,7 @@ src/core/Method.pm
src/core/MixHash.pm
src/core/Mix.pm
src/core/Mixy.pm
src/core/multidim_slice.pm
src/core/Mu.pm
src/core/native_array.pm
src/core/natives.pm
......@@ -285,6 +288,11 @@ src/core/SetHash.pm
src/core/set_operators.pm
src/core/Set.pm
src/core/Setty.pm
src/core/Shaped1Array.pm
src/core/Shaped2Array.pm
src/core/Shaped3Array.pm
src/core/ShapedArray.pm
src/core/ShapedNArray.pm
src/core/signals.pm
src/core/Signature.pm
src/core/Slang.pm
......@@ -303,6 +311,7 @@ src/core/Systemic.pm
src/core/Thread.pm
src/core/ThreadPoolScheduler.pm
src/core/traits.pm
src/core/TypedArray.pm
src/core/UInt64.pm
src/core/Uni.pm
src/core/Variable.pm
......@@ -459,6 +468,8 @@ t/04-nativecall/17-libnames.t
t/04-nativecall/18-routine-sig-sanity.t
t/04-nativecall/19-function-pointers.c
t/04-nativecall/19-function-pointers.t
t/04-nativecall/20-concurrent.c
t/04-nativecall/20-concurrent.t
t/04-nativecall/CompileTestLib.pm
t/fudgeandrun
t/harness5
......@@ -472,6 +483,7 @@ tools/build/create-moar-runner.pl
tools/build/gen-cat.nqp
tools/build/gen-version.pl
tools/build/install-core-dist.pl
tools/build/jvm_core_sources
tools/build-localtest.pl
tools/build/Makefile-common-macros.in
tools/build/Makefile-common-rules.in
......
New in 2016.11
+ Fixes:
+ Various improvements to warning/error-reporting
+ Fixed assigning values to shaped arrays through iterators [839c762]
+ Fixed Str.Int not failing on numerics with combining characters [d540fc8]
+ [JVM] Fixed <a b c>.antipairs breakage [dd7b055]
+ defined routine now correctly authothreads with Junctions [189cb23]
+ Fixed poor randomness when .pick()ing on ranges with >32-bit numbers [34e515d]
+ Fixed infix:<x> silencing Failures [2dd0ddb]
+ Fixed edge case in is-approx that triggers DivByZero exception [f7770ed]
+ (Windows) Fixed returning of an error even when succeeding in mkdir [208a4c2]
+ (Windows) Fixed precomp unable to rename a newly compiled file [44a4c75]
+ (Test.pm) Fixed indent of multi-line diag() and test failure messages [43dbc96]
+ Fixed a callframe crash due to boxing of NULL filenames [200364a]
+ ∞ ≅ ∞ now gives True [4f3681b]
+ Fixed oversharing with grammars used by multiple threads [7a456ff]
+ Fixed incorrect calculations performed by acotan(num) [8e9fd0a]
+ Fixed incorrect calculations performed by asinh(num)/acosh(num) [a7e801f]
+ Fixed acosh return values for large negative numbers [5fe8cf7]
+ asinh(-∞) now returns -∞ instead of NaN [74d0e36]
+ atanh(1) now returns ∞ instead of throwing [906719c][66726e8]
+ Fixed missing close in IO::Path.slurp(:bin) [697a0ae]
+ :U QuantHashes now auto-vivify to their correct type and not Hash [79bb867]
+ Mix/MixHash.Bag/BagHash coersion now ignores negative weights [87bba04]
+ arity-0 infix:<Z> now returns a Seq instead of a List [3fdae43]
+ Fix augment of a nested package [87880ca]
+ Smartmatch with Regex variable now returns a Match instead of Bool [5ac593e]
+ Empty ()[0] now returns Nil instead of False [f50e39b]
+ Failed IO::Socket::Async connection no longer produces unexpected crash [f50e39b]
+ Quitting Supplies with no QUIT phasers no longer unexpectedly crash [f50e39b]
+ Fixed NativeCall issues on big endian machines [627a77e]
+ Fixed broken handling of $/ in some uses of `.match` [ba152bd]
+ Fixed Lock.protect not releasing the lock on control exceptions [48c2af6]
+ MoarVM now builds on any version of macOS [b4dfed2]
+ Fixed concurrency crashes due to garbage collection [6dc5074]
+ Fixed race condition in EmptyIterator [ed2631c]
+ Fixed hang with multi-threaded long-running NativeCall calls [f99d958]
+ Made my @a[10] = ^Inf work [aedb8e7]
+ Fixed [;]:delete [3b9c4c9]
+ Fixed incorrect handling of negative weights in ∪ operator [e10f767]
+ duckmap now preserves types of Iterables [43cb55f]
+ Fixed premature overflow to Inf with large Num literals [729d7e3]
+ Fixed race condition in NativeCall callsite used by multiple threads [49fd825]
+ Fixed instabilities in programs launching many threads at startup [0134132]
+ Fixed crash when reporting X::Composition::NotComposable or
X::Inheritance::Unsupported exceptions [a822bcf]
+ Fixed clock_gettime issue on macOS [ee8ae92]
+ Fixed SEGV in multi-threaded programs with strings-as-strands [395f369]
+ `regex` TOP Grammar rule will now backtrack if needed [4ccb2f3]
+ Fixed .rotate/.reverse on 1-dimmed arrays assigning to self [2d56751]
+ Fixed exponentiation involving zeros for Complex numbers [7f32243]
+ Fixed Label.gist [29db214][53d7b72]
+ Fixed certain edge cases of incorrect stringification of Rationals
with .Str, .perl, and .base [b5aa3c5]
+ Additions:
+ Added TWEAK submethod for object construction [fdc90a2][9409d68]
+ Added DateTime.hh-mm-ss [bf51eca]
+ Added parse-base routine [7e21a24]
+ is-approx with no explicit tolerances now uses more complex algorithm to
choose a tolerance to use (same as old is_approx) [82432a4]
+ on failure, is-approx now displays actual values received [b4fe680]
+ Added Iterator.skip-one to skip a single value [71a01e9]
+ Added Iterator.skip-at-least to skip several values [8d357af]
+ Re-imagined Str.match [b7201a8]:
+ the family of :nth is now lazy will return whatever can find
+ non-monotonically increasing :nth iterator values will now die
+ Str.match/subst/subst-mutate now have :as adverb [1b95636][c9a24d9][aaec517]
+ &infix:<eqv> now works with Setty objects [d92e1ad]
+ :ov and :ex adverbs are now illegal in Str.subst [b90c741]
+ Made nextwith/samewith/nextsame/callwith to be real subroutines [70a367d]
+ Added CX::Emit and CX::Done control exceptions [07eeea8]
+ Setty.Mix/.MixHash coercers now use Int weights instead of Bool [7ba7eb4]
+ Implemented :kv,:p,:k,:v on 1-element multidim [;] [764cfcd]
+ .chrs can now also accepts codepoint numbers as Str [4ae3f23]
+ Added support for compilation of Rakudo on Solaris [a43b0c1]
+ IterationEnd.perl/gist/Str now returns text "IterationEnd" [59bb1b1]
+ Added X::Syntax::Number::InvalidCharacter exception [2faa55b]
+ .reverse/rotate on 1-dimmed arrays are now nodal [cd765e6]
+ .line and .file on core Code now references original source files [b068e3a]
+ .rethrow now works on unthrown exceptions [58a4826]
+ All Reals now accept `Whatever` as the second argument to .base() [c1d2599]
+ sub MAIN usage message shows possible Enum values if param is
named and is an Enum [a3be654]
+ Efficiency:
+ Made slip(@a) about 1.2x faster [37d0e46]
+ Made initialization of 2+dimmed array 10x to 16x faster [dfb58d4]
+ Str.match is now about 5% faster [4fc17df]
+ Str.match with :nth feature is now about 2x faster [41e2572]
+ my @a = Str.match(...) is now about 5% faster [e472420]
+ Str.comb(Regex) is now about 7x faster [1794328]
+ Simple Str.subst/subst-mutate is now about 30% faster [364e67b]
+ Match.Str|prematch|postmatch is now about 2x faster [e65d931]
+ Match.Bool is now about 1% faster (not much, but used a lot) [1fce095]
+ Made ~~ /foo/ faster: 2% for successful/6% for failed matches [05b65d0]
+ Made <foo bar baz> ~~ /foo/ about 2x faster [e4dc8b6]
+ Made %h ~~ /foo/ about 2x faster [33eeb32]
+ Frequent accesses of multiple adverbs (e.g. %h<a>:p:exists)
is now 2x faster [f22f894]
+ Made infix:<eqv> faster: Str: 14x, type: 10x, Range: 3.5x,
Int|Seq|Hash: 1.5x, Array: 1.2x [bc7fcc6]
+ IO::Spec::Unix.canonpath is now 7x to 50x faster [f3f00fb]
+ Baggy.roll/pick is now about 10% faster [fc47bbf]
+ Made copying shaped arrays 10x to 20x faster [a1d8e93][0cf7b36][d27ecfa]
+ Made setting up a shaped array 2x as fast [f06e4c3]
+ Made creation of typed shaped arrays 15% faster [f5bf6c1]
+ Made 2d/3d array accesses about 7x as fast [d3a0907]
+ Made AT-POS on 1,2,3dim arrays about 20x faster [feb7bcb]
+ Made creating a shaped array about 50% faster [1293188][576f3a1]
+ Made .AT-POS on 3+ dimmed arrays 20% faster [1bb5aad]
+ Made over-indexed .AT-POS on 1,2,3 dimmed arrays about 10% faster [1bb5aad]
+ Made multi-dimmed ASSIGN-POS about 30% faster [5b2bdeb]
+ Made .ASSIGN-POS for 1,2,3dimmed arrays about 40x faster [050cf72]
+ Made n-dimmed .EXISTS-POS about 1.5x faster [006f008]
+ Made .EXISTS-POS for 1,2,3dimmed arrays about 10x faster [b1c41b7]
+ Made n-dimmed DELETE-POS about 1.3x faster [6ccecb1]
+ Made .DELETE-POS for 1,2,3dimmed arrays about 20x faster [55b9e90]
+ Made n-dimmed BIND-POS about 1.3x faster [2827edb]
+ Made .BIND-POS for 1,2,3dimmed arrays about 20x faster [9f94525]
+ Made @a[10].STORE at least as fast as @a.STORE [8064ff1]
+ Made .kv on shaped Arrays about 4x faster [e42b68e]
+ Made .pairs/.antipairs on shaped Arrays about 2.8x faster [0f2566a][f608a33]
+ Made List.kv about 30% faster [7a2baf4]
+ for loops on 1-dimmed arrays are now 3x faster [ed36e60]
+ .kv on 1-dimmed arrays is now 7x faster [608de26]
+ .pairs/.antipairs on 1-dimmed arrays is now 3x faster [b7d9537][1c425f9]
+ postcircumfix[;] on 2/3 dimmed arrays is now 9x faster [0b97362]
+ Assignment to [;] for 2/3 dimmed arrays is now 10x faster [ce85ba3]
+ [;]:exists for 2/3 dimmed arrays is now 7x faster [e3e3fef]
+ [;]:delete for 2/3 dimmed arrays is now 10x faster [3b9c4c9]
+ [;] := foo for 2/3 dimmed arrays is now 10x faster [eaf4132]
+ .iterator and .values on shaped arrays are now about 4x faster [736ab11]
+ Fixed optimization of shaped arrays that gives 10% gain on simple `for`
loops and likely will give larger gains on bigger programs [b7e632e]
+ Made starting MappyIterator faster, affecting all Hash/Map/Baggy iterator
methods. 2-elem Hash iteration is 1.6x faster [97fb6c2]
+ Made starting a grepper faster: .grep on with no adverbs on 2-element list
is now 20% faster [077c8f0]
+ Made Date/DateTime creation 20% faster [0e7f480]
+ Hashes now use 4 (32-bit) or 8 (64-bit) bytes less memory per stored item [395f369]
+ Rational.Str is now about 40% faster [b5aa3c5]
+ Rational.base is now about 30% faster [b5aa3c5]
+ Various streamlining of code that's hard to measure the final impact of
New in 2016.10
+ Fixes:
+ Many fixes and additions improving JVM backend support
......
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.
2016-10-15 Rakudo #104 (Zoffix)
2016-11-19 Rakudo #105
2016-11-19 Rakudo #105 (Zoffix)
2016-12-17 Rakudo #106
2017-01-21 Rakudo #107
2017-02-18 Rakudo #108
......@@ -424,6 +423,7 @@ Previous releases were bundled as part of monthly Parrot releases.
2016-08-20 Rakudo #102 "2016.08" (Zoffix)
2016-08-20 2016.08.1 (Zoffix)
2016-09-17 Rakudo #103 "2016.09" (Zoffix + NeuralAnomaly)
2016-10-15 Rakudo #104 "2016.10" (Zoffix + NeuralAnomaly)
=head1 COPYRIGHT
......
......@@ -139,6 +139,8 @@ C<IO::Spec::Cygwin> inherits this from C<IO::Spec::Unix>.
C<IO::Spec::Win32.path> will read the first defined of either C<%PATH%> or C<%Path%> as a
semicolon-delimited list.
=back
=head1 AUTHORS
Written by the Rakudo contributors, see the CREDITS file.
......
......@@ -313,15 +313,15 @@ my role Native[Routine $r, $libname where Str|Callable|List] {
nqp::unbox_s($conv), # calling convention
$arg_info,
return_hash_for($r.signature, $r, :$!entry-point));
$!setup = 1;
$!rettype := nqp::decont(map_return_type($r.returns));
$!setup = 1;
}
}
method CALL-ME(|args) {
self!setup unless $!setup;
my Mu $args := nqp::getattr(nqp::decont(args), Capture, '$!list');
my Mu $args := nqp::getattr(nqp::decont(args), Capture, '@!list');
if nqp::elems($args) != $r.signature.arity {
X::TypeCheck::Argument.new(
:objname($.name),
......
......@@ -242,8 +242,16 @@ multi sub is_approx(Mu $got, Mu $expected, $desc = '') is export {
$ok or ($die_on_fail and die-on-fail) or $ok;
}
# We're picking and choosing which tolerance to use here, to make it easier
# to test numbers close to zero, yet maintain relative tolerance elsewhere.
# For example, relative tolerance works equally well with regular and huge,
# but once we go down to zero, things break down: is-approx sin(τ), 0; would
# fail, because the computed relative tolerance is 1. For such cases, absolute
# tolerance is better suited, so we DWIM in the no-tol version of the sub.
multi sub is-approx(Numeric $got, Numeric $expected, $desc = '') is export {
is-approx-calculate($got, $expected, 1e-5, Nil, $desc);
$expected.abs < 1e-6
?? is-approx-calculate($got, $expected, 1e-5, Nil, $desc) # abs-tol
!! is-approx-calculate($got, $expected, Nil, 1e-6, $desc) # rel-tol
}
multi sub is-approx(
......@@ -287,12 +295,22 @@ sub is-approx-calculate (
$abs-tol-ok = $abs-tol-got <= $abs-tol;
}
if $rel-tol.defined {
$rel-tol-got = abs($got - $expected) / max($got.abs, $expected.abs);
$rel-tol-ok = $rel-tol-got <= $rel-tol;
if max($got.abs, $expected.abs) -> $max {
$rel-tol-got = abs($got - $expected) / $max;
$rel-tol-ok = $rel-tol-got <= $rel-tol;
}
else {
# if $max is zero, then both $got and $expected are zero
# and so our relative difference is also zero
$rel-tol-got = 0;
}
}
my $ok = proclaim($abs-tol-ok && $rel-tol-ok, $desc);
unless $ok {
_diag " expected approximately: $expected\n"
~ " got: $got";
unless $abs-tol-ok {
_diag "maximum absolute tolerance: $abs-tol\n"
~ "actual absolute difference: $abs-tol-got";
......@@ -367,9 +385,11 @@ sub _diag(Mu $message, :$force-stderr) {
my $out = $is_todo ?? $todo_output !! $failure_output;
$time_after = nqp::time_n;
my $str-message = nqp::join("\n# ", nqp::split("\n", "# $message"));
$str-message .= subst(rx/^^'#' \s+ $$/, '', :g);
$out.say: $indents ~ $str-message;
my $str-message = nqp::join(
"\n$indents# ", nqp::split("\n", "$indents# $message")
);
$str-message .= subst(rx/^^ "$indents#" \s+ $$/, '', :g);
$out.say: $str-message;
$time_before = nqp::time_n;
}
......
......@@ -2776,7 +2776,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
# blocks, we need to ensure we get lexical outers fixed up
# properly when deserializing after pre-comp. To do this we
# make a list of closures, which each point to the outer
# context. These surive serialization and thus point at what
# context. These survive serialization and thus point at what
# has to be fixed up.
sub begin_time_lexical_fixup($block) {
my $has_nested_blocks := 0;
......@@ -3610,7 +3610,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
# Ensure all parameters are simple and build placeholders for
# them.
my $Param := $*W.find_symbol(['Parameter'], :setting-only);
my @p_objs := nqp::getattr($sig, $*W.find_symbol(['Signature'], :setting-only), '$!params');
my @p_objs := nqp::getattr($sig, $*W.find_symbol(['Signature'], :setting-only), '@!params');
my int $i := 0;
my int $n := nqp::elems(@params);
my %arg_placeholders;
......@@ -4239,13 +4239,13 @@ class Perl6::Actions is HLL::Actions does STDActions {
# Bind original source to $!source
my $Regex := $*W.find_symbol(['Regex'], :setting-only);
my $source := ($*METHODTYPE ?? $*METHODTYPE ~ ' ' !! '') ~ $/;
my str $source := ($*METHODTYPE ?? $*METHODTYPE ~ ' ' !! '') ~ $/;
my $match := $source ~~ /\s+$/;
if $match {
$source := nqp::substr($source, 0, $match.from());
}
nqp::bindattr($code, $Regex, '$!source', $source);
nqp::bindattr_s($code, $Regex, '$!source', $source);
# Return a reference to the code object
reference_to_code_object($code, $past);
......@@ -6082,7 +6082,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
for @children {
if nqp::istype($_, QAST::Stmt) {
# Mustn't use QAST::Stmt here, as it will cause register
# re-use within a statemnet, which is a problem.
# re-use within a statement, which is a problem.
$_ := QAST::Stmts.new( |$_.list );
}
$past.push($_);
......@@ -6581,7 +6581,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
if nqp::istype($lhs_ast, QAST::Var)
&& nqp::objprimspec($lhs_ast.returns) -> $spec {
# Native assignment is only possible to a reference; complain now
# rather than at runtime since we'll innevitably fail.
# rather than at runtime since we'll inevitably fail.
my $scope := $lhs_ast.scope;
if $scope ne 'lexicalref' && $scope ne 'attributeref' {
$lhs_ast.node.CURSOR.typed_sorry('X::Assignment::RO::Comp',
......@@ -7215,10 +7215,10 @@ class Perl6::Actions is HLL::Actions does STDActions {
if $<escale> { # wants a Num
$parti := nqp::tonum_I($parti);
$parti := nqp::div_n($parti, $partf);
if $parti != 0.0 {
$parti := nqp::mul_n($parti, nqp::pow_n(10, nqp::tonum_I($<escale>.ast)));
}
$parti := nqp::div_n($parti, $partf);
make $*W.add_numeric_constant($/, 'Num', $parti);
} else { # wants a Rat
......@@ -7926,7 +7926,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
my $Sig := $*W.find_symbol(['Signature'], :setting-only);
my $Param := $*W.find_symbol(['Parameter'], :setting-only);
my $Iterable := $*W.find_symbol(['Iterable']);
my @p_objs := nqp::getattr($sig, $Sig, '$!params');
my @p_objs := nqp::getattr($sig, $Sig, '@!params');
my int $i := 0;
my int $n := nqp::elems(@params);
while $i < $n {
......@@ -7968,11 +7968,11 @@ class Perl6::Actions is HLL::Actions does STDActions {
:op('p6bindattrinvres'),
QAST::Op.new( :op('create'), $Capture ),
$Capture,
QAST::SVal.new( :value('$!list') ),
QAST::SVal.new( :value('@!list') ),
QAST::Var.new( :name($name), :scope('local') )
),
$Capture,
QAST::SVal.new( :value('$!hash') ),
QAST::SVal.new( :value('%!hash') ),
QAST::Var.new( :name($hash_name), :scope('local') )
)));
}
......@@ -9551,21 +9551,18 @@ class Perl6::RegexActions is QRegex::P6Regex::Actions does STDActions {
}
method codeblock($/) {
my $blockref := $<block>.ast;
my $past :=
QAST::Stmts.new(
make QAST::Stmts.new(
QAST::Op.new(
:op('p6store'),
QAST::Var.new( :name('$/'), :scope<lexical> ),
QAST::Op.new(
:op('p6store'),
QAST::Var.new( :name('$/'), :scope<lexical> ),
QAST::Op.new(
QAST::Var.new( :name('$¢'), :scope<lexical> ),
:name('MATCH'),
:op('callmethod')
)
),
QAST::Op.new( :op<call>, QAST::Op.new( :op('p6capturelex'), $blockref ) )
);
make $past;
QAST::Var.new( :name('$¢'), :scope<lexical> ),
:name('MATCH'),
:op('callmethod')
)
),
QAST::Op.new( :op<call>, block_closure($<block>.ast) )
);
}
method arglist($/) {
......
......@@ -125,7 +125,7 @@ role STD {
$<B>=[<?before .>]
{
# Work out the delimeters.
# Work out the delimiters.
my $c := $/.CURSOR;
my @delims := $c.peek_delimiters($c.target, $c.pos);
my $start := @delims[0];
......@@ -1110,7 +1110,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
# (fatal but not immediately so) and panic (immediately deadly). There
# is a limit on the number of sorrows also. Unlike STD, which emits the
# textual messages as it goes, we keep track of the exception objects
# and, if needed, make a compositite exception group.
# and, if needed, make a composite exception group.
:my @*WORRIES; # exception objects resulting from worry
:my @*SORROWS; # exception objects resulting from sorry
:my $*SORRY_LIMIT := 10; # when sorrow turns to panic
......@@ -2167,6 +2167,9 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
<trait>*
{
my $target_package := $longname && $longname.is_declared_in_global()
?? $*GLOBALish
!! $*OUTERPACKAGE;
# Unless we're augmenting...
if $*SCOPE ne 'augment' {
......@@ -2193,12 +2196,9 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
my @name := $longname ??
$longname.type_name_parts('package name', :decl(1)) !!
[];
my $target_package := $longname && $longname.is_declared_in_global()
?? $*GLOBALish
!! $*OUTERPACKAGE;
if @name && $*SCOPE ne 'anon' {
if @name && $*W.already_declared($*SCOPE, $target_package, $outer, @name) {
$*PACKAGE := $*W.find_symbol(@name);
$*PACKAGE := $*W.find_symbol(@name, cur-package => $target_package);
$exists := 1;
}
}
......@@ -2285,8 +2285,11 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
# Locate type.
my @name :=
$longname.type_name_parts('package name', :decl(1));
my $found;
try { $*PACKAGE := $*W.find_symbol(@name); $found := 1 }
my int $found;
try {
$*PACKAGE := $*W.find_symbol(@name, cur-package => $target_package);
$found := 1
}
unless $found {
$*W.throw($/, 'X::Augment::NoSuchType',
package-kind => $*PKGDECL,
......@@ -4651,7 +4654,7 @@ if $*COMPILING_CORE_SETTING {
}
self.HOW.mixin(self, Term.HOW.curry(Term, $canname, $opname));
}
# Mix an appropraite role into the grammar for parsing the new op.
# Mix an appropriate role into the grammar for parsing the new op.
elsif $is_oper {
my role Oper[$meth_name, $op, $precedence, $declarand] {
token ::($meth_name) { $<sym>=[$op] <O=.genO($precedence, $declarand)> }
......@@ -5086,7 +5089,7 @@ grammar Perl6::QGrammar is HLL::Grammar does STD {
method tweak_to($v) {
self.truly($v, ':to');
# the cursor_init is to ensure it's been initalized the same way
# the cursor_init is to ensure it's been initialized the same way
# 'self' was back in quote_lang
%*LANG<Quote>.HOW.mixin(%*LANG<Quote>, to.HOW.curry(to, self)).'!cursor_init'(self.orig(), :p(self.pos()), :shared(self.'!shared'()))
}
......
This diff is collapsed.
......@@ -7,7 +7,7 @@ role Perl6::Metamodel::BUILDPLAN {
# through the "todo list" each time we need to make an object.
# The plan is an array of arrays. The first element of each
# nested array is an "op" representing the task to perform:
# 0 code = call specified BUILD method
# 0 code = call specified BUILD or TWEAK method
# 1 class name attr_name = try to find initialization value
# 2 class name attr_name = try to find initialization value, or set nqp::list()
# 3 class name attr_name = try to find initialization value, or set nqp::hash()
......@@ -98,6 +98,12 @@ role Perl6::Metamodel::BUILDPLAN {
@plan[+@plan] := [13, $obj, $_.key];
}
# Does it have a TWEAK?
my $TWEAK := $obj.HOW.find_method($obj, 'TWEAK', :no_fallback(1));
if !nqp::isnull($TWEAK) && $TWEAK {
@plan[+@plan] := [0, $TWEAK];
}
# Install plan for this class.
@!BUILDPLAN := @plan;
......
......@@ -15,7 +15,7 @@ role Perl6::Metamodel::C3MRO {
if +@immediate_parents == 1 {
@result := nqp::clone(@immediate_parents[0].HOW.mro(@immediate_parents[0]));
} else {
# Build merge list of lineraizations of all our parents, add
# Build merge list of linearizations of all our parents, add
# immediate parents and merge.
my @merge_list;
for @immediate_parents {
......
......@@ -139,7 +139,7 @@ class Perl6::Metamodel::ParametricRoleHOW
# things we are composing.
$!specialize_lock.protect({
# Run the body block to get the type environment (we know
# the role in this csae).
# the role in this case).
my $type_env;
my $error;
try {
......
......@@ -402,7 +402,7 @@ my class Problems {
}
}
# Implements analsyis related to variable declarations within a block, which
# Implements analysis related to variable declarations within a block, which
# includes lexical to local handling and deciding when immediate blocks may
# be flattened into their surrounding block.
my class BlockVarOptimizer {
......@@ -726,7 +726,7 @@ my class JunctionOptimizer {
}
if $found == 1 {
my $signature := $!symbols.find_in_setting("Signature");
my $iter := nqp::iterator(nqp::getattr($obj.signature, $signature, '$!params'));
my $iter := nqp::iterator(nqp::getattr($obj.signature, $signature, '@!params'));
while $iter {
my $p := nqp::shift($iter);
unless nqp::istype($p.type, $!symbols.Any) {
......@@ -939,9 +939,11 @@ class Perl6::Optimizer {
# We might be able to delete some of the magical variables when they
# are trivially unused, and also simplify takedispatcher.
$vars_info.delete_unused_magicals($block);
$vars_info.delete_unused_autoslurpy();
$vars_info.simplify_takedispatcher();
if $!level >= 1 {
$vars_info.delete_unused_magicals($block);
$vars_info.delete_unused_autoslurpy();
$vars_info.simplify_takedispatcher();
}
# If the block is immediate, we may be able to inline it.
my int $flattened := 0;
......@@ -979,7 +981,9 @@ class Perl6::Optimizer {
}
# Do any possible lexical => local lowering.
$vars_info.lexical_vars_to_locals($block);
if $!level >= 2 {
$vars_info.lexical_vars_to_locals($block);
}
# Incorporate this block's info into outer block's info.
@!block_var_stack[nqp::elems(@!block_var_stack) - 1].incorporate_inner($vars_info, $flattened)
......@@ -1877,7 +1881,7 @@ class Perl6::Optimizer {
try $ok_type := nqp::istype($type, $!symbols.Mu) &&
$type.HOW.archetypes.nominal();
unless $ok_type {
# nqp::ops end up labeled with nqp primtive types; we swap
# nqp::ops end up labeled with nqp primitive types; we swap
# those out for their Perl 6 equivalents.
my int $ps := nqp::objprimspec($type);
if $ps >= 1 && $ps <= 3 {
......@@ -2151,7 +2155,7 @@ class Perl6::Optimizer {
}
$inlined.node($call.node);
# Do an optimzation pass over the inlined code.
# Do an optimization pass over the inlined code.
$!symbols.faking_top_routine($code_obj,
{ self.visit_children($inlined) });
......@@ -2176,7 +2180,7 @@ class Perl6::Optimizer {
$call.unshift(QAST::Op.new(
:op('atpos'),
QAST::Var.new(
:name('$!dispatchees'), :scope('attribute'),
:name('@!dispatchees'), :scope('attribute'),
QAST::Var.new( :name($call.name), :scope('lexical') ),
QAST::WVal.new( :value($!symbols.find_lexical('Routine')) )
),
......@@ -2217,7 +2221,7 @@ class Perl6::Optimizer {
my int $aref := $scope eq 'attributeref';
if $lref || $aref {
my $Signature := $!symbols.find_in_setting("Signature");
my $param := nqp::getattr($sig, $Signature, '$!params')[$p];
my $param := nqp::getattr($sig, $Signature, '@!params')[$p];
if nqp::can($param, 'rw') {
unless $param.rw {
$arg.scope($lref ?? 'lexical' !! 'attribute');
......
......@@ -178,7 +178,7 @@ class Perl6::Pod {
our sub normalize_text($a) {
# given a string of text, possibly including newlines, reduces
# contiguous whitespace to a single space and trim leading and
# trailing whiespace from all logical lines
# trailing whitespace from all logical lines
my $r := subst($a, /\s+/, ' ', :global);
$r := subst($r, /^^\s*/, '');
$r := subst($r, /\s*$$/, '');
......
This diff is collapsed.
class X::Cannot::Lazy { ... }
# Now that Iterable is defined, we add extra methods into Any for the list
# operations. (They can't go into Any right away since we need Attribute to
# define the various roles, and Attribute inherits from Any. We will do a
......@@ -913,12 +911,12 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?"
role Grepper does Iterator {
has Mu $!iter;
has Mu $!test;
method !SET-SELF(\list,Mu \test) {
method SET-SELF(\list,Mu \test) {
$!iter = list.iterator;
$!test := test;
self
}
method new(\list,Mu \test) { nqp::create(self)!SET-SELF(list,test) }
method new(\list,Mu \test) { nqp::create(self).SET-SELF(list,test) }
method is-lazy() { $!iter.is-lazy }
}
method !grep-callable(Callable:D $test) {
......@@ -930,7 +928,7 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?"
nqp::until(
nqp::eqaddr(($_ := $!iter.pull-one),IterationEnd)
|| $!test($_),
Nil
nqp::null
);
$_
}
......@@ -983,7 +981,7 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?"
nqp::until(
nqp::eqaddr(($_ := $!iter.pull-one),IterationEnd)
|| $!test.ACCEPTS($_),
Nil
nqp::null
);
$_
}
......@@ -1894,84 +1892,24 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?"
nqp::if(
nqp::isle_i($n,0),
(),
Rakudo::Internals.SeqNextNFromIterator(self.iterator,$n)
Seq.new(Rakudo::Internals.IterateNextNFromIterator(self.iterator,$n))
)
}
proto method tail(|) { * }
multi method tail(Any:D:) is raw {
nqp::stmts(
(my $result := IterationEnd),
nqp::if(
(my $iter := self.iterator).is-lazy,
Failure.new(X::Cannot::Lazy.new(:action<tail>)),
nqp::stmts(
nqp::until(
nqp::eqaddr((my $pulled := $iter.pull-one),IterationEnd),
($result := $pulled)
),