Skip to content

Instantly share code, notes, and snippets.

View usev6's full-sized avatar

Christian Bartolomäus usev6

  • Berlin, Germany
View GitHub Profile
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp
index e87782c80..d56c41667 100644
--- a/src/Perl6/Actions.nqp
+++ b/src/Perl6/Actions.nqp
@@ -1107,12 +1107,12 @@ role STDActions {
if !$in-fresh-line {
if $strval ~~ /\n/ {
my $strbox := nqp::box_s(nqp::x(" ", -$indent) ~ nqp::unbox_s($strval), $world.find_single_symbol_in_setting("Str"));
- $strval := nqp::unbox_s($strbox.indent($indent));
+ $strval := nqp::unbox_s($strbox.indent(nqp::box_i($indent, $world.find_single_symbol_in_setting("Int"))));
@usev6
usev6 / gist:559c96ddc10b5bb81e58fab0aa20ff65
Created January 28, 2023 18:44
Version.new different strings for v6.e.PREVIEW
$ git diff
diff --git a/src/core.c/Version.pm6 b/src/core.c/Version.pm6
index 2c8b03300..81eb22ed4 100644
--- a/src/core.c/Version.pm6
+++ b/src/core.c/Version.pm6
@@ -129,6 +129,7 @@ class Version {
}
multi method new(Version: Str() $s) {
+ nqp::say("DEBUG_01 new(Version: Str() \$s) called with argument '$s'");
@usev6
usev6 / gist:141ec892ee3c4e91db4a37c41a729f3e
Created April 6, 2022 20:22
jvm error since 1b75e3fa0c
$ ./rakudo-j --ll-exception -e 'use lib "t/spec/packages/Test-Helpers"; use Test::Util'
Method 'stringified' not found for invocant of class 'CompUnit::DependencySpecification'
in <anon> (gen/jvm/CORE.c.setting:14226)
in serialize (gen/jvm/CORE.c.setting:14225)
in <anon> (gen/jvm/CORE.c.setting:14761)
in <anon> (gen/jvm/CORE.c.setting:14759)
in try-load (gen/jvm/CORE.c.setting:14758)
in <anon> (gen/jvm/CORE.c.setting:16918)
in need (gen/jvm/CORE.c.setting:16904)
in need (gen/jvm/CORE.c.setting:16947)
diff --git a/src/core.c/Any-iterable-methods.pm6 b/src/core.c/Any-iterable-methods.pm6
index 0256cf693..de7cd3a8c 100644
--- a/src/core.c/Any-iterable-methods.pm6
+++ b/src/core.c/Any-iterable-methods.pm6
@@ -52,7 +52,7 @@ Consider using a block if any of these are necessary for your mapping code."
nqp::stmts(
(&!block := block),
($!source := source),
- ($!label := label),
+ ($!label := nqp::decont(label)),
@usev6
usev6 / gist:8b21e936a2ee7850345086dd744104e3
Created March 13, 2019 07:35
special case for floats with $exp == 4 on JVM backend
diff --git a/src/HLL/sprintf.nqp b/src/HLL/sprintf.nqp
index c15d371a4..50f80be9e 100644
--- a/src/HLL/sprintf.nqp
+++ b/src/HLL/sprintf.nqp
@@ -327,11 +327,14 @@ my module sprintf {
$float := nqp::div_n($float, nqp::pow_n(10.0, nqp::sub_n($precision, nqp::add_n($exp, 1.0))));
#?if jvm
if $exp == -4 {
- $float := stringify-to-precision($float, $precision + 3);
- $float := nqp::substr($float, 0, nqp::chars($float) - 1) if nqp::chars($float) > 1 && $float ~~ /\.\d**4 0+$/;
S26-documentation/block-leading.t 1 - simple case - contents
S26-documentation/block-leading.t 3 - simple case - leading
S26-documentation/block-leading.t 5 - simple case - stringifies correctly
S26-documentation/block-leading.t 7 - $=pod simple case
S26-documentation/block-leading.t 8 - giraffe - contents
S26-documentation/block-leading.t 10 - giraffe - leading
S26-documentation/block-leading.t 12 - giraffe - stringifies correctly
S26-documentation/block-leading.t 14 - $=pod giraffe
S26-documentation/block-leading.t 22 - a module - contents
S26-documentation/block-leading.t 24 - a module - leading
@usev6
usev6 / gist:cedc5c44dccf8df39f06b4e179e50fab
Last active April 20, 2018 19:57
Java bytecode snippets
Output string with 'printfh' (nqp)
$il.append($ALOAD_1);
$il.append(JAST::Instruction.new( :op('invokestatic'), $TYPE_OPS, "getstderr", $TYPE_SMO, $TYPE_TC ));
$il.append(JAST::Instruction.new( :op('ldc'), "DEBUG_20\n" ));
$il.append($ALOAD_1);
$il.append(JAST::Instruction.new( :op('invokestatic'), $TYPE_OPS, "printfh", 'Long', $TYPE_SMO, $TYPE_STR, $TYPE_TC ));
$il.append($P
@usev6
usev6 / gist:b81dd9afb68cc55398c950c61760a0fc
Created February 18, 2018 19:11
diff fixing NullPointerException method clone(Array:D) {} and method clone(Hash:D) {}
diff --git a/src/core/Array.pm b/src/core/Array.pm
index 6fff8b91f..c435a9d51 100644
--- a/src/core/Array.pm
+++ b/src/core/Array.pm
@@ -51,14 +51,14 @@ my class Array { # declared in BOOTSTRAP
nqp::stmts(
(my \iter := self.iterator),
(my \result := nqp::p6bindattrinvres(nqp::create(self),
- Array, '$!descriptor', nqp::clone($!descriptor))),
+ Array, '$!descriptor', nqp::isnull($!descriptor) ?? Mu !! nqp::clone($!descriptor))),
@usev6
usev6 / gist:605eaccde110012aa2060d77459fab0a
Created January 19, 2018 21:36
spectest failures on JVM
$ cat ~/j-spectest_2018-01-19.txt
Failure summary:
note: test_summary.pl @syn does not have MIS
MISC/bug-coverage-stress.rakudo.jvm aborted 4 test(s)
S02-types/capture.t 35 - text matches '/'Capture|(Scalar|' \d+ ')'/'
S02-types/capture.t 43 - types whose .Capture behaves like Mu.Capture
S03-operators/set_difference.t aborted 2 test(s)
S03-operators/set_proper_subset.t aborted 2 test(s)
S03-operators/set_subset.t aborted 2 test(s)
S03-operators/set_symmetric_difference.t aborted 2 test(s)
@usev6
usev6 / gist:2e15b87350d481eb73905bfc3ae9f952
Created November 2, 2017 08:16
Failing tests for \c[BELL] on JVM
$ PERL6LIB=lib ./perl6-j t/spec/S32-str/parse-names.t
1..20
ok 1 - empty string (sub form)
ok 2 - one char (sub form)
ok 3 - one char with whitespace around it (sub form)
ok 4 - two chars (sub form)
ok 5 - two chars with whitespace around (sub form)
1..2
ok 1 -
ok 2 - right exception type (X::Str::InvalidCharName)