Skip to content

Commit

Permalink
Properly capitalize the Allomorph class
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Aug 25, 2020
1 parent 716cacd commit 4872c3f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
22 changes: 11 additions & 11 deletions src/core.c/allomorphs.pm6
@@ -1,14 +1,14 @@
my class allomorph is Str {
my class Allomorph is Str {
multi method Bool(::?CLASS:D:) { self.Numeric.Bool }

method succ(allomorph:D:) { self.Numeric.succ }
method pred(allomorph:D:) { self.Numeric.pred }
method succ(Allomorph:D:) { self.Numeric.succ }
method pred(Allomorph:D:) { self.Numeric.pred }

multi method Str(allomorph:D:) {
multi method Str(Allomorph:D:) {
nqp::getattr_s(self,Str,'$!value')
}

multi method WHICH(allomorph:D:) {
multi method WHICH(Allomorph:D:) {
nqp::box_s(
nqp::join('|',nqp::list_s(
self.^name,
Expand All @@ -19,15 +19,15 @@ my class allomorph is Str {
)
}

multi method raku(allomorph:D:) {
multi method raku(Allomorph:D:) {
nqp::join("",nqp::list_s(
self.^name,'.new(',self.Numeric.raku,', ',self.Str.raku,')'
))
}
}

# the uses of add_I in this class are a trick to make bigints work right
my class IntStr is allomorph is Int {
my class IntStr is Allomorph is Int {
method new(Int:D $i, Str:D $s) {
my \SELF = nqp::add_I($i, 0, self);
nqp::bindattr_s(SELF, Str, '$!value', $s);
Expand All @@ -51,7 +51,7 @@ my class IntStr is allomorph is Int {
multi method Int(IntStr:D:) { nqp::add_I(self,0,Int) }
}

my class NumStr is allomorph is Num {
my class NumStr is Allomorph is Num {
method new(Num:D $n, Str:D $s) {
my \new = nqp::create(self);
nqp::bindattr_n(new,Num,'$!value',$n);
Expand All @@ -75,7 +75,7 @@ my class NumStr is allomorph is Num {
multi method Int(NumStr:D:) { nqp::getattr_n(self,Num,'$!value').Int }
}

my class RatStr is allomorph is Rat {
my class RatStr is Allomorph is Rat {
method new(Rat:D $r, Str:D $s) {
my \new = nqp::create(self); # no need to normalize, so don't call .new
nqp::bindattr(new,Rat,'$!numerator',
Expand Down Expand Up @@ -114,7 +114,7 @@ my class RatStr is allomorph is Rat {
}
}

my class ComplexStr is allomorph is Complex {
my class ComplexStr is Allomorph is Complex {
method new(Complex:D $c, Str $s) {
my \new = nqp::create(self);
nqp::bindattr_n(new,Complex,'$!re',
Expand Down Expand Up @@ -191,7 +191,7 @@ multi sub infix:<cmp>(ComplexStr:D $a, RatStr:D $b) { $a.Complex cmp $b.Rat
multi sub infix:<cmp>(ComplexStr:D $a, NumStr:D $b) { $a.Complex cmp $b.Num || $a.Str cmp $b.Str }
multi sub infix:<cmp>(ComplexStr:D $a, ComplexStr:D $b) { $a.Complex cmp $b.Complex || $a.Str cmp $b.Str }

multi sub infix:<eqv>(allomorph:D $a, allomorph:D $b --> Bool:D) is default {
multi sub infix:<eqv>(Allomorph:D $a, Allomorph:D $b --> Bool:D) is default {
nqp::eqaddr($a.WHAT,$b.WHAT)
?? $a.Numeric eqv $b.Numeric && $a.Str eqv $b.Str
!! False
Expand Down
2 changes: 1 addition & 1 deletion t/02-rakudo/03-corekeys-6c.t
Expand Up @@ -486,6 +486,7 @@ my @expected = (
Q{&words},
Q{&zip},
Q{AST},
Q{Allomorph},
Q{Any},
Q{Array},
Q{Associative},
Expand Down Expand Up @@ -726,7 +727,6 @@ my @expected = (
Q{WhateverCode},
Q{WrapDispatcher},
Q{X},
Q{allomorph},
Q{array},
Q{atomicint},
Q{blob16},
Expand Down
2 changes: 1 addition & 1 deletion t/02-rakudo/03-corekeys-6d.t
Expand Up @@ -486,6 +486,7 @@ my @expected = (
Q{&words},
Q{&zip},
Q{AST},
Q{Allomorph},
Q{Any},
Q{Array},
Q{Associative},
Expand Down Expand Up @@ -726,7 +727,6 @@ my @expected = (
Q{WhateverCode},
Q{WrapDispatcher},
Q{X},
Q{allomorph},
Q{array},
Q{atomicint},
Q{blob16},
Expand Down
2 changes: 1 addition & 1 deletion t/02-rakudo/03-corekeys-6e.t
Expand Up @@ -488,6 +488,7 @@ my @expected = (
Q{&words},
Q{&zip},
Q{AST},
Q{Allomorph},
Q{Any},
Q{Array},
Q{Associative},
Expand Down Expand Up @@ -728,7 +729,6 @@ my @expected = (
Q{WhateverCode},
Q{WrapDispatcher},
Q{X},
Q{allomorph},
Q{array},
Q{atomicint},
Q{blob16},
Expand Down
2 changes: 1 addition & 1 deletion t/02-rakudo/03-corekeys.t
Expand Up @@ -489,6 +489,7 @@ my @allowed =
Q{&words},
Q{&zip},
Q{AST},
Q{Allomorph},
Q{Any},
Q{Array},
Q{Associative},
Expand Down Expand Up @@ -729,7 +730,6 @@ my @allowed =
Q{WhateverCode},
Q{WrapDispatcher},
Q{X},
Q{allomorph},
Q{array},
Q{atomicint},
Q{blob16},
Expand Down
2 changes: 1 addition & 1 deletion t/02-rakudo/04-settingkeys-6c.t
Expand Up @@ -485,6 +485,7 @@ my %allowed = (
Q{&words},
Q{&zip},
Q{AST},
Q{Allomorph},
Q{Any},
Q{Array},
Q{Associative},
Expand Down Expand Up @@ -726,7 +727,6 @@ my %allowed = (
Q{WhateverCode},
Q{WrapDispatcher},
Q{X},
Q{allomorph},
Q{array},
Q{atomicint},
Q{blob16},
Expand Down
2 changes: 1 addition & 1 deletion t/02-rakudo/04-settingkeys-6e.t
Expand Up @@ -485,6 +485,7 @@ my %allowed = (
Q{&words},
Q{&zip},
Q{AST},
Q{Allomorph},
Q{Any},
Q{Array},
Q{Associative},
Expand Down Expand Up @@ -726,7 +727,6 @@ my %allowed = (
Q{WhateverCode},
Q{WrapDispatcher},
Q{X},
Q{allomorph},
Q{array},
Q{atomicint},
Q{blob16},
Expand Down

0 comments on commit 4872c3f

Please sign in to comment.