Skip to content

Commit

Permalink
Merge branch 'master' into post-release
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Jan 16, 2018
2 parents 43b9c82 + d0be53a commit f8c2b55
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 16 deletions.
3 changes: 0 additions & 3 deletions src/Perl6/Actions.nqp
Expand Up @@ -1950,9 +1950,6 @@ class Perl6::Actions is HLL::Actions does STDActions {

method statement_control:sym<need>($/) {
my $past := QAST::WVal.new( :value($*W.find_symbol(['Nil'])) );
for $<version> {
# XXX TODO: Version checks.
}
make $past;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Perl6/Grammar.nqp
Expand Up @@ -1575,9 +1575,9 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
rule statement_control:sym<need> {
<sym>
[
| <version>
| <version> <.sorry('In case of using pragma, use "use" instead (e.g., "use v6;", "use v6.c;").')>
| <module_name>
] +% ','
]+ % ','
{
for $<module_name> {
my $lnd := $*W.dissect_longname($_<longname>);
Expand Down
6 changes: 4 additions & 2 deletions src/core/Any.pm
Expand Up @@ -605,9 +605,11 @@ sub dd(|) {
my $var := nqp::shift($args);
my $name := try $var.VAR.?name;
my $type := $var.WHAT.^name;
my $what := (try $var.?is-lazy)
my $what := nqp::can($var, 'is-lazy') && $var.is-lazy
?? $var[^10].perl.chop ~ "... lazy list)"
!! (try $var.perl) // "(low-level $var.^name())";
!! nqp::can($var, 'perl')
?? $var.perl
!! "($var.^name() without .perl method)";
note $name ?? "$type $name = $what" !! $what;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/Exception.pm
Expand Up @@ -1050,7 +1050,7 @@ my class X::Undeclared::Symbols does X::Comp {
new => "method call syntax",
foreach => "for",
use => '"v" prefix for pragma (e.g., "use v6;", "use v6.c;")',
need => '"v" prefix for pragma (e.g., "need v6;", "need v6.c;")',
need => '"v" prefix and "use" for pragma (e.g., "use v6;", "use v6.c;")',
}
$r ~= "Undeclared routine" ~ (%.unk_routines.elems == 1 ?? "" !! "s") ~ ":\n";
for %.unk_routines.sort(*.key) {
Expand Down
5 changes: 3 additions & 2 deletions src/core/Rakudo/Iterator.pm
Expand Up @@ -550,7 +550,8 @@ class Rakudo::Iterator {
}
method new(\it,\si,\pa) { nqp::create(self)!SET-SELF(it,si,pa) }
method pull-one() is raw {
nqp::if($!is-exhausted,
nqp::if(
$!is-exhausted,
IterationEnd,
nqp::stmts(
(my $reified := nqp::create(IterationBuffer)),
Expand Down Expand Up @@ -2795,7 +2796,7 @@ class Rakudo::Iterator {
has $!cycle;
has $!buffer;
has int $!complete;
has int $!is-exhausted = 0;
has int $!is-exhausted;
method !SET-SELF(\iterator,\cycle,\partial) {
nqp::stmts(
($!iterator := iterator),
Expand Down
10 changes: 7 additions & 3 deletions src/core/operators.pm
Expand Up @@ -9,7 +9,11 @@ sub infix:<=>(Mu \a, Mu \b) is raw {

my class X::Does::TypeObject is Exception {
has Mu $.type;
method message() { "Cannot use 'does' operator with a type object." }
has %.nameds;
method message() {
"Cannot use 'does' operator on a type object {$!type.^name}."
~ ("\nAdditional named parameters: {%!nameds.perl}." if %!nameds)
}
}

proto sub infix:<does>(|) {*}
Expand All @@ -28,8 +32,8 @@ multi sub infix:<does>(Mu:D \obj, Mu:U \rolish, :$value! is raw) is raw {
my \mixedin = obj.^mixin($role, :need-mixin-attribute);
mixedin.BUILD_LEAST_DERIVED({ substr(mixedin.^mixin_attribute.Str,2) => $value });
}
multi sub infix:<does>(Mu:U \obj, Mu:U \role) is raw {
X::Does::TypeObject.new(type => obj).throw
multi sub infix:<does>(Mu:U \obj, Mu:U \role, *%_) is raw {
X::Does::TypeObject.new(type => obj, nameds => %_).throw
}
multi sub infix:<does>(Mu:D \obj, **@roles) is raw {
# XXX Mutability check.
Expand Down
12 changes: 9 additions & 3 deletions t/05-messages/02-errors.t
Expand Up @@ -2,7 +2,7 @@ use lib <t/packages/>;
use Test;
use Test::Helpers;

plan 35;
plan 36;

# RT #132295

Expand Down Expand Up @@ -279,8 +279,14 @@ throws-like { EVAL "use 6.0;" }, X::Undeclared::Symbols,
:message{ .contains: 'use "v" prefix for pragma (e.g., "use v6;", "use v6.c;")' },
'suggests to use "use v6;" or "use v6.c;" when "use 6.0" is called';

# RT132214

throws-like { EVAL "need 6.0;" }, X::Undeclared::Symbols,
:message{ .contains: 'use "v" prefix for pragma (e.g., "need v6;", "need v6.c;")' },
'suggests to use "need v6;" or "need v6.c;" when "need 6.0" is called';
:message{ .contains: 'use "v" prefix and "use" for pragma (e.g., "use v6;", "use v6.c;")' },
'suggests to use "use v6;" or "use v6.c;" when "need 6.0" is called';

throws-like { EVAL "need v6.0;" }, Exception,
:message{ .contains: 'In case of using pragma, use "use" instead (e.g., "use v6;", "use v6.c;").' },
'suggests to use "use v6;" or "use v6.c;" when "need 6.0" is called';

# vim: ft=perl6 expandtab sw=4

0 comments on commit f8c2b55

Please sign in to comment.