Created
September 9, 2020 15:30
-
-
Save alabamenhu/b2109f1ab0590f9a6e366d0125d0e3ab to your computer and use it in GitHub Desktop.
Translation Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# EXCEPTIONS LOCALIZATION FOR ---- | |
# | |
# Note that this file has been automatically generated. | |
# Do NOT allow a code editor to reformat, as it will mess up (NYI) comparison | |
# and update scripts. | |
# | |
# 1. Change the ?? to your language code | |
unit module Intl::X::??; | |
# 2. Rename this template file to match the language code | |
# 3. Place in the lib/Intl/X/ directory. | |
# 4. Add the module to the 'provides' section of META6.json | |
# 5. Violà :-) | |
use MONKEY-GUTS; | |
our %exceptions = Map.new: | |
# These first few are special translations that are not directly messages, | |
# but may be produced as a part of other messages. They should be very stable | |
# however should be checked upon each release that they match the current set | |
# of special translations. All translations MUST exist on a single line for | |
# proper post-processing. | |
# | |
# BEGIN SPECIAL TRANSLATIONS (DO NOT EDIT THIS LINE) | |
'Exception.something-wrong' => method { "Something went wrong in {self.WHAT.gist}" }, | |
'Exception.died-with' => method { "Died with {self.^name}" }, | |
'Exception.no-backtrace' => method { ' (no backtrace available)' }, | |
'Exception.unknown' => method { "Unthrown {self.^name} with no message" }, | |
'X::Comp::Group.sorry' => method { 'SORRY!' }, | |
'X::Comp::Group.difficulties' => method { 'Potential difficulties:' }, | |
'X::Comp::Group.other-diff' => method { 'Other potential difficulties:' }, | |
'X::SecurityPolicy::Eval.payload' => method { 'EVAL is a very dangerous function!!!' }, | |
'X::AdHoc.payload' => method { 'Unexplained error' }, | |
'X::StubCode.default' => method { 'Stub code executed' }, | |
'X::Met.default' => method { 'Stub code executed' }, | |
'X::Method::NotFound.of-type' => method { "of type '$.typename'" }, | |
'X::Method::NotFound.no-public' => method { "No such private method '!$.method' for invocant $.of-type" }, | |
'X::Method::NotFound.no-private' => method { "No such method '$.method' for invocant $.of-type" }, | |
'X::Method::NotFound.private-sug' => method { "Method name starts with '!', did you mean 'self!\"__INDIRECT-METHOD__\"()'?" }, | |
'X::Method::NotFound.suggestion' => method { "Did you mean '@.suggestions[0]'?" }, | |
'X::Method::NotFound.suggestions' => method { "Did you mean any of these: { @.suggestions.map( { "'$_'" } ).join(", ") }?" }, | |
'X::Method::NotFound.perhaps-public' => method { "Perhaps a public method call must be used." }, | |
'X::Method::NotFound.perhaps-private' => method { "Perhaps a private method call must be used." }, | |
'X::Method::NotFound.possible' => method { ($.addendum ?? "Other possible" !! "Possible") ~ " causes are:" }, | |
# END SPECIAL TRANSLATIONS (DO NOT EDIT THIS LINE) | |
# For each of the following entries, do not edit the original code in | |
# in the comment block, as it is used for tracking. | |
# Only adjust the code inside of the primary method block. | |
# Class: CX::Done | |
# Status: TO DO | |
# Original Code: | |
# "<done control exception>" | |
'CX::Done' => method { | |
"<done control exception>" | |
}, | |
# Class: CX::Emit | |
# Status: TO DO | |
# Original Code: | |
# "<emit control exception>" | |
'CX::Emit' => method { | |
"<emit control exception>" | |
}, | |
# Class: CX::Last | |
# Status: TO DO | |
# Original Code: | |
# "<last control exception>" | |
'CX::Last' => method { | |
"<last control exception>" | |
}, | |
# Class: CX::Proceed | |
# Status: TO DO | |
# Original Code: | |
# "<proceed control exception>" | |
'CX::Proceed' => method { | |
"<proceed control exception>" | |
}, | |
# Class: CX::Redo | |
# Status: TO DO | |
# Original Code: | |
# "<redo control exception>" | |
'CX::Redo' => method { | |
"<redo control exception>" | |
}, | |
# Class: CX::Return | |
# Status: TO DO | |
# Original Code: | |
# "<return control exception>" | |
'CX::Return' => method { | |
"<return control exception>" | |
}, | |
# Class: CX::Succeed | |
# Status: TO DO | |
# Original Code: | |
# "<succeed control exception>" | |
'CX::Succeed' => method { | |
"<succeed control exception>" | |
}, | |
# Class: CX::Take | |
# Status: TO DO | |
# Original Code: | |
# "<take control exception>" | |
'CX::Take' => method { | |
"<take control exception>" | |
}, | |
# Class: X::AdHoc | |
# Status: TO DO | |
# Note: The SlurpySentry referenced is an old internal role, nowadays unused. | |
# Most languages should simply use '$.payload.Str' as the entire method, | |
# which is what CORE should probably do as well. | |
# Original Code: | |
# # Remove spaces for die(*@msg)/fail(*@msg) forms | |
# given $.payload { | |
# when SlurpySentry { | |
# $_.list.join; | |
# } | |
# default { | |
# .Str; | |
# } | |
# } | |
'X::AdHoc' => method { | |
# Remove spaces for die(*@msg)/fail(*@msg) forms | |
given $.payload { | |
when SlurpySentry { | |
$_.list.join; | |
} | |
default { | |
.Str; | |
} | |
} | |
}, | |
# Class: X::Adverb | |
# Status: TO DO | |
# Original Code: | |
# $.target.defined | |
# ?? "Cannot bind to $.target" | |
# !! 'Cannot use bind operator with this left-hand side' | |
'X::Adverb' => method { | |
$.target.defined | |
?? "Cannot bind to $.target" | |
!! 'Cannot use bind operator with this left-hand side' | |
}, | |
# Class: X::Anon::Augment | |
# Status: TO DO | |
# Original Code: | |
# "Cannot augment anonymous $.package-kind" | |
'X::Anon::Augment' => method { | |
"Cannot augment anonymous $.package-kind" | |
}, | |
# Class: X::Anon::Multi | |
# Status: TO DO | |
# Original Code: | |
# "An anonymous $.routine-type may not take a $.multiness declarator" | |
'X::Anon::Multi' => method { | |
"An anonymous $.routine-type may not take a $.multiness declarator" | |
}, | |
# Class: X::ArrayShapeMismatch | |
# Status: TO DO | |
# Original Code: | |
# "Cannot assign an array of shape $.source-shape to an array of shape $.target-shape" | |
'X::ArrayShapeMismatch' => method { | |
"Cannot assign an array of shape $.source-shape to an array of shape $.target-shape" | |
}, | |
# Class: X::Assignment::ArrayShapeMismatch | |
# Status: TO DO | |
# Original Code: | |
# "Assignment to array with shape $.shape must provide structured data" | |
'X::Assignment::ArrayShapeMismatch' => method { | |
"Assignment to array with shape $.shape must provide structured data" | |
}, | |
# Class: X::Attribute::NoPackage | |
# Status: TO DO | |
# Original Code: | |
# "You cannot declare attribute '$.name' here; maybe you'd like a class or a role?" | |
'X::Attribute::NoPackage' => method { | |
"You cannot declare attribute '$.name' here; maybe you'd like a class or a role?" | |
}, | |
# Class: X::Attribute::Package | |
# Status: TO DO | |
# Original Code: | |
# "A $.package-kind cannot have attributes, but you tried to declare '$.name'" | |
'X::Attribute::Package' => method { | |
"A $.package-kind cannot have attributes, but you tried to declare '$.name'" | |
}, | |
# Class: X::Attribute::Regex | |
# Status: TO DO | |
# Original Code: | |
# "Attribute '$.symbol' not available inside of a regex, since regexes are methods on the Cursor class. Consider storing the attribute in a lexical, and using that in the regex.".naive-word-wrapper | |
'X::Attribute::Regex' => method { | |
"Attribute '$.symbol' not available inside of a regex, since regexes are methods on the Cursor class. Consider storing the attribute in a lexical, and using that in the regex.".naive-word-wrapper | |
}, | |
# Class: X::Attribute::Required | |
# Status: TO DO | |
# Original Code: | |
# $.why && nqp::istype($.why,Str) | |
# ?? "The attribute '$.name' is required because $.why,\nbut you did not provide a value for it." | |
# !! "The attribute '$.name' is required, but you did not provide a value for it." | |
'X::Attribute::Required' => method { | |
$.why && nqp::istype($.why,Str) | |
?? "The attribute '$.name' is required because $.why,\nbut you did not provide a value for it." | |
!! "The attribute '$.name' is required, but you did not provide a value for it." | |
}, | |
# Class: X::Attribute::Scope::Package | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use '$.scope' with $.declaration declaration" | |
'X::Attribute::Scope::Package' => method { | |
"Cannot use '$.scope' with $.declaration declaration" | |
}, | |
# Class: X::Attribute::Undeclared | |
# Status: TO DO | |
# Original Code: | |
# "Attribute $.symbol not declared in $.package-kind $.package-name"; | |
'X::Attribute::Undeclared' => method { | |
"Attribute $.symbol not declared in $.package-kind $.package-name"; | |
}, | |
# Class: X::Augment::NoSuchType | |
# Status: TO DO | |
# Original Code: | |
# "You tried to augment $.package-kind $.package, but it does not exist" | |
'X::Augment::NoSuchType' => method { | |
"You tried to augment $.package-kind $.package, but it does not exist" | |
}, | |
# Class: X::Backslash::NonVariableDollar | |
# Status: TO DO | |
# Original Code: | |
# "Non-variable \$ must be backslashed" | |
'X::Backslash::NonVariableDollar' => method { | |
"Non-variable \$ must be backslashed" | |
}, | |
# Class: X::Backslash::UnrecognizedSequence | |
# Status: TO DO | |
# Original Code: | |
# "Unrecognized backslash sequence: '\\$.sequence'" | |
# ~ (nqp::defined($!suggestion) ?? ". Did you mean $!suggestion?" !! '') | |
'X::Backslash::UnrecognizedSequence' => method { | |
"Unrecognized backslash sequence: '\\$.sequence'" | |
~ (nqp::defined($!suggestion) ?? ". Did you mean $!suggestion?" !! '') | |
}, | |
# Class: X::Bind::NativeType | |
# Status: TO DO | |
# Original Code: | |
# "Cannot bind to natively typed variable '$.name'; use assignment instead" | |
'X::Bind::NativeType' => method { | |
"Cannot bind to natively typed variable '$.name'; use assignment instead" | |
}, | |
# Class: X::Bind::Slice | |
# Status: TO DO | |
# Original Code: | |
# "Cannot bind to {$.type.^name} slice"; | |
'X::Bind::Slice' => method { | |
"Cannot bind to {$.type.^name} slice"; | |
}, | |
# Class: X::Bind::ZenSlice | |
# Status: TO DO | |
# Original Code: | |
# "Cannot bind to {$.type.^name} zen slice"; | |
'X::Bind::ZenSlice' => method { | |
"Cannot bind to {$.type.^name} zen slice"; | |
}, | |
# Class: X::Buf::AsStr | |
# Status: TO DO | |
# Original Code: | |
# my $message = $.method.starts-with('Str') | |
# ?? "Stringification of a {$.object.^name} is not done with '$.method'" | |
# !! "A {$.object.^name} is not a Str, so using '$.method' will not work"; | |
# ($message ~ ". The 'decode' method should be used to convert a {$.object.^name} to a Str." | |
# ).naive-word-wrapper | |
'X::Buf::AsStr' => method { | |
my $message = $.method.starts-with('Str') | |
?? "Stringification of a {$.object.^name} is not done with '$.method'" | |
!! "A {$.object.^name} is not a Str, so using '$.method' will not work"; | |
($message ~ ". The 'decode' method should be used to convert a {$.object.^name} to a Str." | |
).naive-word-wrapper | |
}, | |
# Class: X::Buf::Pack | |
# Status: TO DO | |
# Original Code: | |
# "Unrecognized directive '$.directive'"; | |
'X::Buf::Pack' => method { | |
"Unrecognized directive '$.directive'"; | |
}, | |
# Class: X::Buf::Pack::NonASCII | |
# Status: TO DO | |
# Original Code: | |
# "non-ASCII character '$.char' while processing an 'A' template in pack"; | |
'X::Buf::Pack::NonASCII' => method { | |
"non-ASCII character '$.char' while processing an 'A' template in pack"; | |
}, | |
# Class: X::Cannot::Capture | |
# Status: TO DO | |
# Original Code: | |
# "Cannot unpack or Capture `$!what.gist()`.\n" | |
# ~ "To create a Capture, add parentheses: \\(...)\n" | |
# ~ 'If unpacking in a signature, perhaps you needlessly used' | |
# ~ ' parentheses? -> ($x) {} vs. -> $x {}' | |
# ~ "\nor missed `:` in signature unpacking? -> \&c:(Int) \{}"; | |
'X::Cannot::Capture' => method { | |
"Cannot unpack or Capture `$!what.gist()`.\n" | |
~ "To create a Capture, add parentheses: \\(...)\n" | |
~ 'If unpacking in a signature, perhaps you needlessly used' | |
~ ' parentheses? -> ($x) {} vs. -> $x {}' | |
~ "\nor missed `:` in signature unpacking? -> \&c:(Int) \{}"; | |
}, | |
# Class: X::Cannot::Empty | |
# Status: TO DO | |
# Original Code: | |
# "Cannot $.action from an empty $.what"; | |
'X::Cannot::Empty' => method { | |
"Cannot $.action from an empty $.what"; | |
}, | |
# Class: X::Cannot::Junction | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use Junction '$.junction' $.for." | |
'X::Cannot::Junction' => method { | |
"Cannot use Junction '$.junction' $.for." | |
}, | |
# Class: X::Cannot::Lazy | |
# Status: TO DO | |
# Original Code: | |
# $.what | |
# ?? "Cannot $.action a lazy list onto a $.what" | |
# !! "Cannot $.action a lazy list"; | |
'X::Cannot::Lazy' => method { | |
$.what | |
?? "Cannot $.action a lazy list onto a $.what" | |
!! "Cannot $.action a lazy list"; | |
}, | |
# Class: X::Cannot::Map | |
# Status: TO DO | |
# Original Code: | |
# my $message = "Cannot map a $.what using $.using"; | |
# $.suggestion ?? "$message\n$.suggestion" !! $message | |
'X::Cannot::Map' => method { | |
my $message = "Cannot map a $.what using $.using"; | |
$.suggestion ?? "$message\n$.suggestion" !! $message | |
}, | |
# Class: X::Cannot::New | |
# Status: TO DO | |
# Original Code: | |
# "Cannot make a {$.class.^name} object using .new"; | |
'X::Cannot::New' => method { | |
"Cannot make a {$.class.^name} object using .new"; | |
}, | |
# Class: X::Comp::BeginTime | |
# Status: TO DO | |
# Original Code: | |
# $!exception ~~ X::MOP | |
# ?? $!exception.message | |
# !! "An exception occurred while $!use-case" | |
'X::Comp::BeginTime' => method { | |
$!exception ~~ X::MOP | |
?? $!exception.message | |
!! "An exception occurred while $!use-case" | |
}, | |
# Class: X::Comp::FailGoal | |
# Status: TO DO | |
# Original Code: | |
# my $msg = "{ $.feature andthen "$_ not" orelse "Not" } yet implemented. Sorry."; | |
# $msg ~= "\nDid you mean: {$.did-you-mean.gist}?" if $.did-you-mean; | |
# $msg ~= "\nWorkaround: $.workaround" if $.workaround; | |
# $msg | |
'X::Comp::FailGoal' => method { | |
my $msg = "{ $.feature andthen "$_ not" orelse "Not" } yet implemented. Sorry."; | |
$msg ~= "\nDid you mean: {$.did-you-mean.gist}?" if $.did-you-mean; | |
$msg ~= "\nWorkaround: $.workaround" if $.workaround; | |
$msg | |
}, | |
# Class: X::Comp::WheneverOutOfScope | |
# Status: TO DO | |
# Original Code: | |
# "Cannot have a 'whenever' block outside the scope of a 'supply' or 'react' block" | |
'X::Comp::WheneverOutOfScope' => method { | |
"Cannot have a 'whenever' block outside the scope of a 'supply' or 'react' block" | |
}, | |
# Class: X::CompUnit::UnsatisfiedDependency | |
# Status: TO DO | |
# Original Code: | |
# my $name = $.specification.short-name; | |
# is-core($name) | |
# ?? "{$name} is a builtin type, not an external module" | |
# !! "Could not find $.specification in:\n" | |
# ~ $*REPO.repo-chain.map(*.path-spec).join("\n").indent(4) | |
# ~ ($.specification ~~ / $<name>=.+ '::from' $ / | |
# ?? "\n\nIf you meant to use the :from adverb, use" | |
# ~ " a single colon for it: $<name>:from<...>\n" | |
# !! '' | |
# ) | |
'X::CompUnit::UnsatisfiedDependency' => method { | |
my $name = $.specification.short-name; | |
is-core($name) | |
?? "{$name} is a builtin type, not an external module" | |
!! "Could not find $.specification in:\n" | |
~ $*REPO.repo-chain.map(*.path-spec).join("\n").indent(4) | |
~ ($.specification ~~ / $<name>=.+ '::from' $ / | |
?? "\n\nIf you meant to use the :from adverb, use" | |
~ " a single colon for it: $<name>:from<...>\n" | |
!! '' | |
) | |
}, | |
# Class: X::Composition::NotComposable | |
# Status: TO DO | |
# Original Code: | |
# $!composer.^name ~ " is not composable, so $!target-name cannot compose it"; | |
'X::Composition::NotComposable' => method { | |
$!composer.^name ~ " is not composable, so $!target-name cannot compose it"; | |
}, | |
# Class: X::Constructor::Positional | |
# Status: TO DO | |
# Original Code: | |
# "Default constructor for '" ~ $.type.^name ~ "' only takes named arguments" | |
'X::Constructor::Positional' => method { | |
"Default constructor for '" ~ $.type.^name ~ "' only takes named arguments" | |
}, | |
# Class: X::ControlFlow | |
# Status: TO DO | |
# Original Code: | |
# "$.illegal without $.enclosing" | |
'X::ControlFlow' => method { | |
"$.illegal without $.enclosing" | |
}, | |
# Class: X::ControlFlow::Return | |
# Status: TO DO | |
# Note: Use $.out-of-dynamic-scope instead of $!out-of-dynamic-scope in translations | |
# Original Code: | |
# 'Attempt to return outside of ' ~ ( | |
# $!out-of-dynamic-scope | |
# ?? 'immediately-enclosing Routine (i.e. `return` execution is' | |
# ~ ' outside the dynamic scope of the Routine where `return` was used)' | |
# !! 'any Routine' | |
# ) | |
'X::ControlFlow::Return' => method { | |
'Attempt to return outside of ' ~ ( | |
$!out-of-dynamic-scope | |
?? 'immediately-enclosing Routine (i.e. `return` execution is' | |
~ ' outside the dynamic scope of the Routine where `return` was used)' | |
!! 'any Routine' | |
) | |
}, | |
# Class: X::DateTime::InvalidDeltaUnit | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use unit $.unit with Date.delta"; | |
'X::DateTime::InvalidDeltaUnit' => method { | |
"Cannot use unit $.unit with Date.delta"; | |
}, | |
# Class: X::DateTime::TimezoneClash | |
# Status: TO DO | |
# Original Code: | |
# 'DateTime.new(Str): :timezone argument not allowed with a timestamp offset'; | |
'X::DateTime::TimezoneClash' => method { | |
'DateTime.new(Str): :timezone argument not allowed with a timestamp offset'; | |
}, | |
# Class: X::Declaration::OurScopeInRole | |
# Status: TO DO | |
# Original Code: | |
# "Cannot declare our-scoped $.declaration inside of a role\n" ~ | |
# "(the scope inside of a role is generic, so there is no unambiguous\n" ~ | |
# "package to install the symbol in)" | |
'X::Declaration::OurScopeInRole' => method { | |
"Cannot declare our-scoped $.declaration inside of a role\n" ~ | |
"(the scope inside of a role is generic, so there is no unambiguous\n" ~ | |
"package to install the symbol in)" | |
}, | |
# Class: X::Declaration::Scope::Multi | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use '$.scope' with individual multi candidates. Please declare an {$.scope}-scoped proto instead"; | |
'X::Declaration::Scope::Multi' => method { | |
"Cannot use '$.scope' with individual multi candidates. Please declare an {$.scope}-scoped proto instead"; | |
}, | |
# Class: X::Dynamic::NotFound | |
# Status: TO DO | |
# Original Code: | |
# "Dynamic variable $.name not found"; | |
'X::Dynamic::NotFound' => method { | |
"Dynamic variable $.name not found"; | |
}, | |
# Class: X::Dynamic::Package | |
# Status: TO DO | |
# Original Code: | |
# "Dynamic variables cannot have package-like names (with '::'), so '$!symbol' is not allowed.".naive-word-wrapper | |
'X::Dynamic::Package' => method { | |
"Dynamic variables cannot have package-like names (with '::'), so '$!symbol' is not allowed.".naive-word-wrapper | |
}, | |
# Class: X::Dynamic::Postdeclaration | |
# Status: TO DO | |
# Original Code: | |
# "Illegal post-declaration of dynamic variable '$.symbol'. Earlier access must be written as 'CALLERS::<$.symbol>' if that's what you meant.".naive-word-wrapper | |
'X::Dynamic::Postdeclaration' => method { | |
"Illegal post-declaration of dynamic variable '$.symbol'. Earlier access must be written as 'CALLERS::<$.symbol>' if that's what you meant.".naive-word-wrapper | |
}, | |
# Class: X::EXPORTHOW::Conflict | |
# Status: TO DO | |
# Original Code: | |
# "'EXPORTHOW::{$.directive}::{$.declarator}' conflicts with an existing meta-object imported into this lexical scope" | |
'X::EXPORTHOW::Conflict' => method { | |
"'EXPORTHOW::{$.directive}::{$.declarator}' conflicts with an existing meta-object imported into this lexical scope" | |
}, | |
# Class: X::EXPORTHOW::NothingToSupersede | |
# Status: TO DO | |
# Original Code: | |
# "There is no package declarator '$.declarator' to supersede" | |
'X::EXPORTHOW::NothingToSupersede' => method { | |
"There is no package declarator '$.declarator' to supersede" | |
}, | |
# Class: X::Encoding::AlreadyRegistered | |
# Status: TO DO | |
# Original Code: | |
# "An encoding with name '$.name' has already been registered" | |
'X::Encoding::AlreadyRegistered' => method { | |
"An encoding with name '$.name' has already been registered" | |
}, | |
# Class: X::Encoding::Unknown | |
# Status: TO DO | |
# Original Code: | |
# "Unknown string encoding '$.name'" | |
'X::Encoding::Unknown' => method { | |
"Unknown string encoding '$.name'" | |
}, | |
# Class: X::Eval::NoSuchLang | |
# Status: TO DO | |
# Original Code: | |
# "No compiler available for language '$.lang'"; | |
'X::Eval::NoSuchLang' => method { | |
"No compiler available for language '$.lang'"; | |
}, | |
# Class: X::Exhausted | |
# Status: TO DO | |
# Original Code: | |
# my $result = $.comment.defined | |
# ?? "$.what out of range. Is: $.got.gist(), should be in $.range.gist(); $.comment" | |
# !! "$.what out of range. Is: $.got.gist(), should be in $.range.gist()"; | |
# $result; | |
'X::Exhausted' => method { | |
my $result = $.comment.defined | |
?? "$.what out of range. Is: $.got.gist(), should be in $.range.gist(); $.comment" | |
!! "$.what out of range. Is: $.got.gist(), should be in $.range.gist()"; | |
$result; | |
}, | |
# Class: X::Experimental | |
# Status: TO DO | |
# Original Code: | |
# "Use of $.feature is experimental; please 'use experimental :$.use'" | |
'X::Experimental' => method { | |
"Use of $.feature is experimental; please 'use experimental :$.use'" | |
}, | |
# Class: X::Hash::Store::OddNumber | |
# Status: TO DO | |
# Original Code: | |
# my $msg = | |
# "Odd number of elements found where hash initializer expected"; | |
# if $.found == 1 { | |
# $msg ~= $.last | |
# ?? ":\nOnly saw: $.last.raku()" | |
# !! ":\nOnly saw 1 element" | |
# } | |
# else { | |
# $msg ~= ":\nFound $.found (implicit) elements"; | |
# $msg ~= ":\nLast element seen: $.last.raku()" if $.last; | |
# } | |
'X::Hash::Store::OddNumber' => method { | |
my $msg = | |
"Odd number of elements found where hash initializer expected"; | |
if $.found == 1 { | |
$msg ~= $.last | |
?? ":\nOnly saw: $.last.raku()" | |
!! ":\nOnly saw 1 element" | |
} | |
else { | |
$msg ~= ":\nFound $.found (implicit) elements"; | |
$msg ~= ":\nLast element seen: $.last.raku()" if $.last; | |
} | |
}, | |
# Class: X::HyperOp::Infinite | |
# Status: TO DO | |
# Original Code: | |
# $.side eq "both" | |
# ?? "Lists on both sides of hyperop of &.operator.name() are known to be infinite" | |
# !! "List on $.side side of hyperop of &.operator.name() is known to be infinite" | |
'X::HyperOp::Infinite' => method { | |
$.side eq "both" | |
?? "Lists on both sides of hyperop of &.operator.name() are known to be infinite" | |
!! "List on $.side side of hyperop of &.operator.name() is known to be infinite" | |
}, | |
# Class: X::HyperOp::NonDWIM | |
# Status: TO DO | |
# Original Code: | |
# "Lists on either side of non-dwimmy hyperop of &.operator.name() are not of the same length" | |
# ~ " while recursing" x +$.recursing | |
# ~ "\nleft: $.left-elems elements, right: $.right-elems elements"; | |
'X::HyperOp::NonDWIM' => method { | |
"Lists on either side of non-dwimmy hyperop of &.operator.name() are not of the same length" | |
~ " while recursing" x +$.recursing | |
~ "\nleft: $.left-elems elements, right: $.right-elems elements"; | |
}, | |
# Class: X::HyperWhatever::Multiple | |
# Status: TO DO | |
# Original Code: | |
# "Multiple HyperWhatevers and Whatevers may not be used together" | |
# } | |
# } | |
# | |
#my class X::EXPORTHOW::InvalidDirective does X::Comp { | |
# has $.directive; | |
# method message() { | |
# "Unknown EXPORTHOW directive '$.directive' encountered during import" | |
'X::HyperWhatever::Multiple' => method { | |
"Multiple HyperWhatevers and Whatevers may not be used together" | |
} | |
} | |
my class X::EXPORTHOW::InvalidDirective does X::Comp { | |
has $.directive; | |
method message() { | |
"Unknown EXPORTHOW directive '$.directive' encountered during import" | |
}, | |
# Class: X::IO::BinaryAndEncoding | |
# Status: TO DO | |
# Original Code: | |
# my @m; | |
# for @.sorrows { | |
# @m.append(.message); | |
# } | |
# if $.panic { | |
# @m.append($.panic.message); | |
# } | |
# for @.worries { | |
# @m.append(.message); | |
# } | |
# @m.join("\n") | |
'X::IO::BinaryAndEncoding' => method { | |
my @m; | |
for @.sorrows { | |
@m.append(.message); | |
} | |
if $.panic { | |
@m.append($.panic.message); | |
} | |
for @.worries { | |
@m.append(.message); | |
} | |
@m.join("\n") | |
}, | |
# Class: X::IO::Chdir | |
# Status: TO DO | |
# Original Code: | |
# "Failed to change the working directory to '$.path': $.os-error" | |
'X::IO::Chdir' => method { | |
"Failed to change the working directory to '$.path': $.os-error" | |
}, | |
# Class: X::IO::Chmod | |
# Status: TO DO | |
# Original Code: | |
# "Failed to set the mode of '$.path' to '0o{$.mode.fmt("%03o")}': $.os-error" | |
'X::IO::Chmod' => method { | |
"Failed to set the mode of '$.path' to '0o{$.mode.fmt("%03o")}': $.os-error" | |
}, | |
# Class: X::IO::Copy | |
# Status: TO DO | |
# Original Code: | |
# "Failed to copy '$.from' to '$.to': $.os-error" | |
'X::IO::Copy' => method { | |
"Failed to copy '$.from' to '$.to': $.os-error" | |
}, | |
# Class: X::IO::Cwd | |
# Status: TO DO | |
# Original Code: | |
# "Failed to get the working directory: $.os-error" | |
'X::IO::Cwd' => method { | |
"Failed to get the working directory: $.os-error" | |
}, | |
# Class: X::IO::Dir | |
# Status: TO DO | |
# Original Code: | |
# "Failed to get the directory contents of '$.path': $.os-error" | |
'X::IO::Dir' => method { | |
"Failed to get the directory contents of '$.path': $.os-error" | |
}, | |
# Class: X::IO::Directory | |
# Status: TO DO | |
# Original Code: | |
# my $x = "'$.path' is a directory, cannot do '.$.trying' on a directory"; | |
# if $.use { $x ~= ", try '{$.use}()' instead" } | |
# $x; | |
'X::IO::Directory' => method { | |
my $x = "'$.path' is a directory, cannot do '.$.trying' on a directory"; | |
if $.use { $x ~= ", try '{$.use}()' instead" } | |
$x; | |
}, | |
# Class: X::IO::DoesNotExist | |
# Status: TO DO | |
# Original Code: | |
# "Failed to find '$.path' while trying to do '.$.trying'" | |
'X::IO::DoesNotExist' => method { | |
"Failed to find '$.path' while trying to do '.$.trying'" | |
}, | |
# Class: X::IO::Flush | |
# Status: TO DO | |
# Original Code: | |
# "Cannot flush handle: $.os-error" | |
'X::IO::Flush' => method { | |
"Cannot flush handle: $.os-error" | |
}, | |
# Class: X::IO::Link | |
# Status: TO DO | |
# Original Code: | |
# "Failed to create link called '$.name' on target '$.target': $.os-error" | |
'X::IO::Link' => method { | |
"Failed to create link called '$.name' on target '$.target': $.os-error" | |
}, | |
# Class: X::IO::Lock | |
# Status: TO DO | |
# Original Code: | |
# "Could not obtain $.lock-type lock: $.os-error" | |
'X::IO::Lock' => method { | |
"Could not obtain $.lock-type lock: $.os-error" | |
}, | |
# Class: X::IO::Mkdir | |
# Status: TO DO | |
# Original Code: | |
# "Failed to create directory '$.path' with mode '0o{$.mode.fmt("%03o")}': $.os-error" | |
'X::IO::Mkdir' => method { | |
"Failed to create directory '$.path' with mode '0o{$.mode.fmt("%03o")}': $.os-error" | |
}, | |
# Class: X::IO::Move | |
# Status: TO DO | |
# Original Code: | |
# "Failed to move '$.from' to '$.to': $.os-error" | |
'X::IO::Move' => method { | |
"Failed to move '$.from' to '$.to': $.os-error" | |
}, | |
# Class: X::IO::NotAChild | |
# Status: TO DO | |
# Original Code: | |
# "Path {$.child.raku} is not a child of path {$.path.raku}" | |
'X::IO::NotAChild' => method { | |
"Path {$.child.raku} is not a child of path {$.path.raku}" | |
}, | |
# Class: X::IO::NotAFile | |
# Status: TO DO | |
# Original Code: | |
# "'$.path' is not a regular file while trying to do '.$.trying'" | |
'X::IO::NotAFile' => method { | |
"'$.path' is not a regular file while trying to do '.$.trying'" | |
}, | |
# Class: X::IO::Null | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use null character (U+0000) as part of the path" | |
'X::IO::Null' => method { | |
"Cannot use null character (U+0000) as part of the path" | |
}, | |
# Class: X::IO::Resolve | |
# Status: TO DO | |
# Original Code: | |
# "Failed to completely resolve {$.path.raku}" | |
'X::IO::Resolve' => method { | |
"Failed to completely resolve {$.path.raku}" | |
}, | |
# Class: X::IO::Rmdir | |
# Status: TO DO | |
# Original Code: | |
# "Failed to remove the directory '$.path': $.os-error" | |
'X::IO::Rmdir' => method { | |
"Failed to remove the directory '$.path': $.os-error" | |
}, | |
# Class: X::IO::Symlink | |
# Status: TO DO | |
# Original Code: | |
# "Failed to create symlink called '$.name' on target '$.target': $.os-error" | |
'X::IO::Symlink' => method { | |
"Failed to create symlink called '$.name' on target '$.target': $.os-error" | |
}, | |
# Class: X::IO::Unknown | |
# Status: TO DO | |
# Original Code: | |
# "Failed to rename '$.from' to '$.to': $.os-error" | |
'X::IO::Unknown' => method { | |
"Failed to rename '$.from' to '$.to': $.os-error" | |
}, | |
# Class: X::IO::Unlink | |
# Status: TO DO | |
# Original Code: | |
# "Failed to remove the file '$.path': $.os-error" | |
'X::IO::Unlink' => method { | |
"Failed to remove the file '$.path': $.os-error" | |
}, | |
# Class: X::IllegalDimensionInShape | |
# Status: TO DO | |
# Original Code: | |
# "Illegal dimension in shape: $.dim. All dimensions must be integers bigger than 0" | |
'X::IllegalDimensionInShape' => method { | |
"Illegal dimension in shape: $.dim. All dimensions must be integers bigger than 0" | |
}, | |
# Class: X::IllegalOnFixedDimensionArray | |
# Status: TO DO | |
# Original Code: | |
# "Cannot $.operation a fixed-dimension array" | |
'X::IllegalOnFixedDimensionArray' => method { | |
"Cannot $.operation a fixed-dimension array" | |
}, | |
# Class: X::Import::MissingSymbols | |
# Status: TO DO | |
# Original Code: | |
# "Trying to import from '$.from', but the following symbols are missing: " | |
# ~ @.missing.join(', '); | |
'X::Import::MissingSymbols' => method { | |
"Trying to import from '$.from', but the following symbols are missing: " | |
~ @.missing.join(', '); | |
}, | |
# Class: X::Import::NoSuchTag | |
# Status: TO DO | |
# Original Code: | |
# "Error while importing from '$.source-package': no such tag '$.tag'" | |
'X::Import::NoSuchTag' => method { | |
"Error while importing from '$.source-package': no such tag '$.tag'" | |
}, | |
# Class: X::Import::OnlystarProto | |
# Status: TO DO | |
# Original Code: | |
# (@.symbols == 1 | |
# ?? "Cannot import symbol '@.symbols[0]' from '$.source-package-name', because only onlystar-protos ('proto foo(|) {*}') can be merged." | |
# !! "Cannot import the following symbols from '$.source-package-name', only onlystar-protos ('proto foo(|) {*}') can be merged: { @.symbols.map( { "'$_'" } ).join(', ')}." | |
# ).naive-word-wrapper | |
'X::Import::OnlystarProto' => method { | |
(@.symbols == 1 | |
?? "Cannot import symbol '@.symbols[0]' from '$.source-package-name', because only onlystar-protos ('proto foo(|) {*}') can be merged." | |
!! "Cannot import the following symbols from '$.source-package-name', only onlystar-protos ('proto foo(|) {*}') can be merged: { @.symbols.map( { "'$_'" } ).join(', ')}." | |
).naive-word-wrapper | |
}, | |
# Class: X::Import::Positional | |
# Status: TO DO | |
# Original Code: | |
# "Error while importing from '$.source-package':\n" | |
# ~ "no EXPORT sub, but you provided positional argument in the 'use' statement" | |
'X::Import::Positional' => method { | |
"Error while importing from '$.source-package':\n" | |
~ "no EXPORT sub, but you provided positional argument in the 'use' statement" | |
}, | |
# Class: X::Import::Redeclaration | |
# Status: TO DO | |
# Original Code: | |
# (@.symbols == 1 | |
# ?? "Cannot import symbol '@.symbols[0]' from '$.source-package-name', because it already exists in this lexical scope." | |
# !! "Cannot import the following symbols from '$.source-package-name', because they already exist in this lexical scope: { @.symbols.map( { "'$_'" } ).join(', ')}." | |
# ).naive-word-wrapper | |
'X::Import::Redeclaration' => method { | |
(@.symbols == 1 | |
?? "Cannot import symbol '@.symbols[0]' from '$.source-package-name', because it already exists in this lexical scope." | |
!! "Cannot import the following symbols from '$.source-package-name', because they already exist in this lexical scope: { @.symbols.map( { "'$_'" } ).join(', ')}." | |
).naive-word-wrapper | |
}, | |
# Class: X::Inheritance::NotComposed | |
# Status: TO DO | |
# Original Code: | |
# "'$.child-name' cannot inherit from '$.parent-name' because '$.parent-name' isn't composed yet" | |
# ~ ' (maybe it is stubbed)'; | |
'X::Inheritance::NotComposed' => method { | |
"'$.child-name' cannot inherit from '$.parent-name' because '$.parent-name' isn't composed yet" | |
~ ' (maybe it is stubbed)'; | |
}, | |
# Class: X::Inheritance::Unsupported | |
# Status: TO DO | |
# Original Code: | |
# "A symbol '$.symbol' has already been exported"; | |
'X::Inheritance::Unsupported' => method { | |
"A symbol '$.symbol' has already been exported"; | |
}, | |
# Class: X::Invalid::Value | |
# Status: TO DO | |
# Original Code: | |
# "$.what value must be known at compile time" | |
'X::Invalid::Value' => method { | |
"$.what value must be known at compile time" | |
}, | |
# Class: X::InvalidType | |
# Status: TO DO | |
# Original Code: | |
# my $msg := "Invalid typename '$.typename'"; | |
# if [email protected] > 0 { | |
# $msg := $msg ~ ". Did you mean '" ~ @.suggestions.join("', '") ~ "'?"; | |
# } | |
# $msg; | |
'X::InvalidType' => method { | |
my $msg := "Invalid typename '$.typename'"; | |
if [email protected] > 0 { | |
$msg := $msg ~ ". Did you mean '" ~ @.suggestions.join("', '") ~ "'?"; | |
} | |
$msg; | |
}, | |
# Class: X::InvalidTypeSmiley | |
# Status: TO DO | |
# Original Code: | |
# "Invalid type smiley ':$.name' used, only ':D', ':U' and ':_' are allowed"; | |
'X::InvalidTypeSmiley' => method { | |
"Invalid type smiley ':$.name' used, only ':D', ':U' and ':_' are allowed"; | |
}, | |
# Class: X::Language::ModRequired | |
# Status: TO DO | |
# Original Code: | |
# "Raku $.version requires $.modifier modifier" | |
'X::Language::ModRequired' => method { | |
"Raku $.version requires $.modifier modifier" | |
}, | |
# Class: X::Language::TooLate | |
# Status: TO DO | |
# Original Code: | |
# "Too late to switch language version. Must be used as the very first statement." | |
'X::Language::TooLate' => method { | |
"Too late to switch language version. Must be used as the very first statement." | |
}, | |
# Class: X::Language::Unsupported | |
# Status: TO DO | |
# Original Code: | |
# "No compiler available for Raku $.version" | |
'X::Language::Unsupported' => method { | |
"No compiler available for Raku $.version" | |
}, | |
# Class: X::LibEmpty | |
# Status: TO DO | |
# Original Code: | |
# "The following packages were stubbed but not defined:\n " | |
# ~ @.packages.join("\n "); | |
'X::LibEmpty' => method { | |
"The following packages were stubbed but not defined:\n " | |
~ @.packages.join("\n "); | |
}, | |
# Class: X::Localizer::NoContainer | |
# Status: TO DO | |
# Original Code: | |
# "Can only use '$.localizer' on a container"; | |
'X::Localizer::NoContainer' => method { | |
"Can only use '$.localizer' on a container"; | |
}, | |
# Class: X::Match::Bool | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use Bool as Matcher with '" ~ $.type ~ "'. Did you mean to use \$_ inside a block?" | |
'X::Match::Bool' => method { | |
"Cannot use Bool as Matcher with '" ~ $.type ~ "'. Did you mean to use \$_ inside a block?" | |
}, | |
# Class: X::Method::InvalidQualifier | |
# Status: TO DO | |
# Original Code: | |
# "Cannot dispatch to method $.method on {$.qualifier-type.^name} " | |
# ~ "because it is not inherited or done by {$.invocant.^name}"; | |
'X::Method::InvalidQualifier' => method { | |
"Cannot dispatch to method $.method on {$.qualifier-type.^name} " | |
~ "because it is not inherited or done by {$.invocant.^name}"; | |
}, | |
# Class: X::Method::Private::Permission | |
# Status: TO DO | |
# Original Code: | |
# "Cannot call private method '$.method' on package '$.source-package' because it does not trust the '$.calling-package' package.".naive-word-wrapper | |
'X::Method::Private::Permission' => method { | |
"Cannot call private method '$.method' on package '$.source-package' because it does not trust the '$.calling-package' package.".naive-word-wrapper | |
}, | |
# Class: X::Method::Private::Unqualified | |
# Status: TO DO | |
# Original Code: | |
# "Calling private method '$.method' must be fully qualified with the package containing that private method.".naive-word-wrapper | |
'X::Method::Private::Unqualified' => method { | |
"Calling private method '$.method' must be fully qualified with the package containing that private method.".naive-word-wrapper | |
}, | |
# Class: X::Mixin::NotComposable | |
# Status: TO DO | |
# Original Code: | |
# "Cannot mix in non-composable type {$.rolish.^name} into object of type {$.target.^name}"; | |
'X::Mixin::NotComposable' => method { | |
"Cannot mix in non-composable type {$.rolish.^name} into object of type {$.target.^name}"; | |
}, | |
# Class: X::MultipleTypeSmiley | |
# Status: TO DO | |
# Original Code: | |
# "Multiple type smileys cannot be used, did you forget a ':' somewhere?"; | |
'X::MultipleTypeSmiley' => method { | |
"Multiple type smileys cannot be used, did you forget a ':' somewhere?"; | |
}, | |
# Class: X::MustBeParametric | |
# Status: TO DO | |
# Original Code: | |
# "$!type.^name() *must* be parameterized"; | |
'X::MustBeParametric' => method { | |
"$!type.^name() *must* be parameterized"; | |
}, | |
# Class: X::NQP::NotFound | |
# Status: TO DO | |
# Original Code: | |
# "Could not find nqp::$.op, did you forget 'use nqp;' ?" | |
'X::NQP::NotFound' => method { | |
"Could not find nqp::$.op, did you forget 'use nqp;' ?" | |
}, | |
# Class: X::NYI::Available | |
# Status: TO DO | |
# Original Code: | |
# "Please install { self.available-str } for $.feature support. " | |
'X::NYI::Available' => method { | |
"Please install { self.available-str } for $.feature support. " | |
}, | |
# Class: X::NYI::BigInt | |
# Status: TO DO | |
# Original Code: | |
# "Big integer $!big not yet supported on {$!side}hand side of '$!op' operator" | |
'X::NYI::BigInt' => method { | |
"Big integer $!big not yet supported on {$!side}hand side of '$!op' operator" | |
}, | |
# Class: X::NoSuchSymbol | |
# Status: TO DO | |
# Original Code: | |
# "Cannot access '$.symbol' through CALLER, because it is not declared as dynamic"; | |
'X::NoSuchSymbol' => method { | |
"Cannot access '$.symbol' through CALLER, because it is not declared as dynamic"; | |
}, | |
# Class: X::NotEnoughDimensions | |
# Status: TO DO | |
# Original Code: | |
# "Cannot $.operation a $.needed-dimensions dimension array with only $.got-dimensions dimensions" | |
'X::NotEnoughDimensions' => method { | |
"Cannot $.operation a $.needed-dimensions dimension array with only $.got-dimensions dimensions" | |
}, | |
# Class: X::NotParametric | |
# Status: TO DO | |
# Original Code: | |
# "$!type.^name() cannot be parameterized"; | |
'X::NotParametric' => method { | |
"$!type.^name() cannot be parameterized"; | |
}, | |
# Class: X::Numeric::CannotConvert | |
# Status: TO DO | |
# Original Code: | |
# "Cannot convert {$!source // $!source.raku} to {$!target // $!target.raku}: $!reason"; | |
'X::Numeric::CannotConvert' => method { | |
"Cannot convert {$!source // $!source.raku} to {$!target // $!target.raku}: $!reason"; | |
}, | |
# Class: X::Numeric::Confused | |
# Status: TO DO | |
# Original Code: | |
# "This call only converts base-$.base strings to numbers; value " | |
# ~ "{$.num.raku} is of type {$.num.WHAT.^name}, so cannot be converted!" | |
# ~ ( | |
# "\n(If you really wanted to convert {$.num.raku} to a base-$.base" | |
# ~ " string, use {$.num.raku}.base($.base) instead.)" | |
# if $.num.^can('base') | |
# ); | |
'X::Numeric::Confused' => method { | |
"This call only converts base-$.base strings to numbers; value " | |
~ "{$.num.raku} is of type {$.num.WHAT.^name}, so cannot be converted!" | |
~ ( | |
"\n(If you really wanted to convert {$.num.raku} to a base-$.base" | |
~ " string, use {$.num.raku}.base($.base) instead.)" | |
if $.num.^can('base') | |
); | |
}, | |
# Class: X::Numeric::DivideByZero | |
# Status: TO DO | |
# Original Code: | |
# "Attempt to divide{$.numerator ?? " $.numerator" !! ''} by zero" | |
# ~ ( $.using ?? " using $.using" !! '' ) | |
# ~ ( " $_" with $.details ); | |
'X::Numeric::DivideByZero' => method { | |
"Attempt to divide{$.numerator ?? " $.numerator" !! ''} by zero" | |
~ ( $.using ?? " using $.using" !! '' ) | |
~ ( " $_" with $.details ); | |
}, | |
# Class: X::Numeric::Overflow | |
# Status: TO DO | |
# Original Code: | |
# "Numeric overflow" | |
'X::Numeric::Overflow' => method { | |
"Numeric overflow" | |
}, | |
# Class: X::Numeric::Underflow | |
# Status: TO DO | |
# Original Code: | |
# "Numeric underflow" | |
'X::Numeric::Underflow' => method { | |
"Numeric underflow" | |
}, | |
# Class: X::Obsolete | |
# Status: TO DO | |
# Original Code: | |
# "Unsupported use of $.old. $.when.tc() please use: $.replacement.".naive-word-wrapper | |
'X::Obsolete' => method { | |
"Unsupported use of $.old. $.when.tc() please use: $.replacement.".naive-word-wrapper | |
}, | |
# Class: X::Pairup::OddNumber | |
# Status: TO DO | |
# Original Code: | |
# "Odd number of elements found for .pairup()" | |
'X::Pairup::OddNumber' => method { | |
"Odd number of elements found for .pairup()" | |
}, | |
# Class: X::Parameter::AfterDefault | |
# Status: TO DO | |
# Original Code: | |
# "The $.type '$.modifier' came after the default value. Did you mean: ...$.modifier $.default?".naive-word-wrapper | |
'X::Parameter::AfterDefault' => method { | |
"The $.type '$.modifier' came after the default value. Did you mean: ...$.modifier $.default?".naive-word-wrapper | |
}, | |
# Class: X::Parameter::BadType | |
# Status: TO DO | |
# Original Code: | |
# my $what = ~$!type.HOW.WHAT.^name.match(/ .* '::' <(.*)> HOW/) // 'Namespace'; | |
# "$what '$!type.^name()' is insufficiently type-like to qualify a parameter. Did you mean 'class'?".naive-word-wrapper | |
'X::Parameter::BadType' => method { | |
my $what = ~$!type.HOW.WHAT.^name.match(/ .* '::' <(.*)> HOW/) // 'Namespace'; | |
"$what '$!type.^name()' is insufficiently type-like to qualify a parameter. Did you mean 'class'?".naive-word-wrapper | |
}, | |
# Class: X::Parameter::Default | |
# Status: TO DO | |
# Original Code: | |
# $.parameter | |
# ?? "Cannot put default on $.how parameter $.parameter" | |
# !! "Cannot put default on anonymous $.how parameter"; | |
'X::Parameter::Default' => method { | |
$.parameter | |
?? "Cannot put default on $.how parameter $.parameter" | |
!! "Cannot put default on anonymous $.how parameter"; | |
}, | |
# Class: X::Parameter::Default::TypeCheck | |
# Status: TO DO | |
# Original Code: | |
# "Default value '{Rakudo::Internals.MAYBE-STRING: $!got}' will never bind to a parameter of type {$!expected.^name}" | |
'X::Parameter::Default::TypeCheck' => method { | |
"Default value '{Rakudo::Internals.MAYBE-STRING: $!got}' will never bind to a parameter of type {$!expected.^name}" | |
}, | |
# Class: X::Parameter::InvalidConcreteness | |
# Status: TO DO | |
# Original Code: | |
# $!routine = '<anon>' if not $!routine.defined or $!routine eq ''; | |
# $!param = '<anon>' if not $!param.defined or $!param eq ''; | |
# my $beginning = $!param-is-invocant ?? 'Invocant of method' !! "Parameter '$!param' of routine"; | |
# my $must-be = $!should-be-concrete ?? 'an object instance' !! 'a type object'; | |
# my $not-a = $!should-be-concrete ?? 'a type object' !! 'an object instance'; | |
# my $suggestion = $!should-be-concrete ?? '.new' !! 'multi'; | |
# | |
# "$beginning '$!routine' must be $must-be of type '$!expected', not $not-a of type '$!got'. Did you forget a '$suggestion'?".naive-word-wrapper | |
'X::Parameter::InvalidConcreteness' => method { | |
$!routine = '<anon>' if not $!routine.defined or $!routine eq ''; | |
$!param = '<anon>' if not $!param.defined or $!param eq ''; | |
my $beginning = $!param-is-invocant ?? 'Invocant of method' !! "Parameter '$!param' of routine"; | |
my $must-be = $!should-be-concrete ?? 'an object instance' !! 'a type object'; | |
my $not-a = $!should-be-concrete ?? 'a type object' !! 'an object instance'; | |
my $suggestion = $!should-be-concrete ?? '.new' !! 'multi'; | |
"$beginning '$!routine' must be $must-be of type '$!expected', not $not-a of type '$!got'. Did you forget a '$suggestion'?".naive-word-wrapper | |
}, | |
# Class: X::Parameter::InvalidType | |
# Status: TO DO | |
# Original Code: | |
# my $msg := "Invalid typename '$.typename' in parameter declaration."; | |
# if [email protected] > 0 { | |
# $msg := $msg ~ " Did you mean '" ~ @.suggestions.join("', '") ~ "'?"; | |
# } | |
# $msg.naive-word-wrapper | |
'X::Parameter::InvalidType' => method { | |
my $msg := "Invalid typename '$.typename' in parameter declaration."; | |
if [email protected] > 0 { | |
$msg := $msg ~ " Did you mean '" ~ @.suggestions.join("', '") ~ "'?"; | |
} | |
$msg.naive-word-wrapper | |
}, | |
# Class: X::Parameter::MultipleTypeConstraints | |
# Status: TO DO | |
# Original Code: | |
# ($.parameter ?? "Parameter $.parameter" !! 'A parameter') | |
# ~ " may only have one prefix type constraint"; | |
'X::Parameter::MultipleTypeConstraints' => method { | |
($.parameter ?? "Parameter $.parameter" !! 'A parameter') | |
~ " may only have one prefix type constraint"; | |
}, | |
# Class: X::Parameter::Placeholder | |
# Status: TO DO | |
# Original Code: | |
# "$.type.tc() placeholder variables like '$.parameter' are not allowed in signatures. Did you mean: '$.right' ?".naive-word-wrapper | |
'X::Parameter::Placeholder' => method { | |
"$.type.tc() placeholder variables like '$.parameter' are not allowed in signatures. Did you mean: '$.right' ?".naive-word-wrapper | |
}, | |
# Class: X::Parameter::RW | |
# Status: TO DO | |
# Original Code: | |
# "Parameter '$.symbol' expects a writable container (variable) as an argument, but got '{Rakudo::Internals.MAYBE-GIST: $.got}' ($.got.^name()) as a value without a container.".naive-word-wrapper | |
'X::Parameter::RW' => method { | |
"Parameter '$.symbol' expects a writable container (variable) as an argument, but got '{Rakudo::Internals.MAYBE-GIST: $.got}' ($.got.^name()) as a value without a container.".naive-word-wrapper | |
}, | |
# Class: X::Parameter::Twigil | |
# Status: TO DO | |
# Original Code: | |
# "Parameters with a '$.twigil' twigil, like '$.parameter', are not allowed in signatures.".naive-word-wrapper | |
'X::Parameter::Twigil' => method { | |
"Parameters with a '$.twigil' twigil, like '$.parameter', are not allowed in signatures.".naive-word-wrapper | |
}, | |
# Class: X::Parameter::TypedSlurpy | |
# Status: TO DO | |
# Original Code: | |
# "Slurpy $.kind parameters with type constraints are not supported" | |
'X::Parameter::TypedSlurpy' => method { | |
"Slurpy $.kind parameters with type constraints are not supported" | |
}, | |
# Class: X::Parameter::WrongOrder | |
# Status: TO DO | |
# Original Code: | |
# "Cannot put $.misplaced parameter $.parameter after $.after parameters"; | |
'X::Parameter::WrongOrder' => method { | |
"Cannot put $.misplaced parameter $.parameter after $.after parameters"; | |
}, | |
# Class: X::ParametricConstant | |
# Status: TO DO | |
# Original Code: | |
# self.priors() ~ | |
# "Type check failed in $.operation; expected $.expectedn but got $.gotn"; | |
'X::ParametricConstant' => method { | |
self.priors() ~ | |
"Type check failed in $.operation; expected $.expectedn but got $.gotn"; | |
}, | |
# Class: X::Phaser::Multiple | |
# Status: TO DO | |
# Original Code: | |
# "Only one $.block block is allowed" | |
'X::Phaser::Multiple' => method { | |
"Only one $.block block is allowed" | |
}, | |
# Class: X::Phaser::PrePost | |
# Status: TO DO | |
# Original Code: | |
# $!name.chars ?? "Unrecognized character name [{$!name}]" | |
# !! "Cannot use empty name as character name" | |
'X::Phaser::PrePost' => method { | |
$!name.chars ?? "Unrecognized character name [{$!name}]" | |
!! "Cannot use empty name as character name" | |
}, | |
# Class: X::PhaserExceptions | |
# Status: TO DO | |
# Original Code: | |
# "Multiple exceptions were thrown by LEAVE/POST phasers" | |
'X::PhaserExceptions' => method { | |
"Multiple exceptions were thrown by LEAVE/POST phasers" | |
}, | |
# Class: X::Placeholder::Attribute | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use placeholder parameter $.placeholder in an attribute initializer" | |
'X::Placeholder::Attribute' => method { | |
"Cannot use placeholder parameter $.placeholder in an attribute initializer" | |
}, | |
# Class: X::Placeholder::Block | |
# Status: TO DO | |
# Original Code: | |
# "Placeholder variable '$.placeholder' may not be used here because the surrounding block does not take a signature.".naive-word-wrapper; | |
'X::Placeholder::Block' => method { | |
"Placeholder variable '$.placeholder' may not be used here because the surrounding block does not take a signature.".naive-word-wrapper; | |
}, | |
# Class: X::Placeholder::Mainline | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use placeholder parameter $.placeholder outside of a sub or block" | |
'X::Placeholder::Mainline' => method { | |
"Cannot use placeholder parameter $.placeholder outside of a sub or block" | |
}, | |
# Class: X::Placeholder::NonPlaceholder | |
# Status: TO DO | |
# Original Code: | |
# my $decl = $!decl ?? $!decl !! 'block'; | |
# "'$!variable_name' has already been used as a non-placeholder in the surrounding $decl, so you will confuse the reader if you suddenly declare $!placeholder here.".naive-word-wrapper | |
'X::Placeholder::NonPlaceholder' => method { | |
my $decl = $!decl ?? $!decl !! 'block'; | |
"'$!variable_name' has already been used as a non-placeholder in the surrounding $decl, so you will confuse the reader if you suddenly declare $!placeholder here.".naive-word-wrapper | |
}, | |
# Class: X::PoisonedAlias | |
# Status: TO DO | |
# Original Code: | |
# ("Cannot directly use poisoned alias '$.alias' because it was declared by several {$.package-type}s." ~ | |
# ($.package-name | |
# ?? " Please access it via explicit package name like: '{$.package-name}::{$!alias}'" | |
# !! '') | |
# ).naive-word-wrapper | |
'X::PoisonedAlias' => method { | |
("Cannot directly use poisoned alias '$.alias' because it was declared by several {$.package-type}s." ~ | |
($.package-name | |
?? " Please access it via explicit package name like: '{$.package-name}::{$!alias}'" | |
!! '') | |
).naive-word-wrapper | |
}, | |
# Class: X::Proc::Unsuccessful | |
# Status: TO DO | |
# Original Code: | |
# "The spawned command '{$.proc.command[0]}' exited unsuccessfully (exit code: $.proc.exitcode(), signal: $.proc.signal())" | |
'X::Proc::Unsuccessful' => method { | |
"The spawned command '{$.proc.command[0]}' exited unsuccessfully (exit code: $.proc.exitcode(), signal: $.proc.signal())" | |
}, | |
# Class: X::PseudoPackage::InDeclaration | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use pseudo package $.pseudo-package in $.action"; | |
'X::PseudoPackage::InDeclaration' => method { | |
"Cannot use pseudo package $.pseudo-package in $.action"; | |
}, | |
# Class: X::Range::InvalidArg | |
# Status: TO DO | |
# Original Code: | |
# "{$.got.^name} objects are not valid endpoints for Ranges"; | |
'X::Range::InvalidArg' => method { | |
"{$.got.^name} objects are not valid endpoints for Ranges"; | |
}, | |
# Class: X::Redeclaration::Outer | |
# Status: TO DO | |
# Original Code: | |
# "Lexical symbol '$.symbol' is already bound to an outer symbol. The implicit outer binding must be rewritten as 'OUTER::<$.symbol>' before you can unambiguously declare a new '$.symbol' in this scope.".naive-word-wrapper | |
'X::Redeclaration::Outer' => method { | |
"Lexical symbol '$.symbol' is already bound to an outer symbol. The implicit outer binding must be rewritten as 'OUTER::<$.symbol>' before you can unambiguously declare a new '$.symbol' in this scope.".naive-word-wrapper | |
}, | |
# Class: X::Role::Parametric::NoSuchCandidate | |
# Status: TO DO | |
# Original Code: | |
# "<next control exception>" | |
'X::Role::Parametric::NoSuchCandidate' => method { | |
"<next control exception>" | |
}, | |
# Class: X::Routine::Unwrap | |
# Status: TO DO | |
# Original Code: | |
# "Cannot unwrap routine: invalid wrap handle" | |
'X::Routine::Unwrap' => method { | |
"Cannot unwrap routine: invalid wrap handle" | |
}, | |
# Class: X::SecurityPolicy::Eval | |
# Status: TO DO | |
# Note: The SlurpySentry referenced is an internal role, however it is unused. | |
# Simply use $.payload.Str instead, which is what CORE should have. | |
# Original Code: | |
# (($.payload ~~ SlurpySentry | |
# ?? $.payload.list.join # Remove spaces die(*@msg)/fail(*@msg) forms | |
# !! $.payload.Str | |
# ) ~ " (use the MONKEY-SEE-NO-EVAL pragma to override this error but only if you're VERY sure your data contains no injection attacks)." | |
# ).naive-word-wrapper | |
'X::SecurityPolicy::Eval' => method { | |
(($.payload ~~ SlurpySentry | |
?? $.payload.list.join # Remove spaces die(*@msg)/fail(*@msg) forms | |
!! $.payload.Str | |
) ~ " (use the MONKEY-SEE-NO-EVAL pragma to override this error but only if you're VERY sure your data contains no injection attacks)." | |
).naive-word-wrapper | |
}, | |
# Class: X::Seq::Consumed | |
# Status: TO DO | |
# Original Code: | |
# "The iterator of this Seq is already in use/consumed by another Seq\n" ~ | |
# "(you might solve this by adding .cache on usages of the Seq, or\n" ~ | |
# "by assigning the Seq into an array)" | |
'X::Seq::Consumed' => method { | |
"The iterator of this Seq is already in use/consumed by another Seq\n" ~ | |
"(you might solve this by adding .cache on usages of the Seq, or\n" ~ | |
"by assigning the Seq into an array)" | |
}, | |
# Class: X::Seq::NotIndexable | |
# Status: TO DO | |
# Original Code: | |
# "Cannot index a Seq; coerce it to a list or assign it to an array first" | |
'X::Seq::NotIndexable' => method { | |
"Cannot index a Seq; coerce it to a list or assign it to an array first" | |
}, | |
# Class: X::Sequence::Deduction | |
# Status: TO DO | |
# Original Code: | |
# $!from ?? "Unable to deduce arithmetic or geometric sequence from: $!from\nDid you really mean '..'?" | |
# !! 'Unable to deduce sequence for some unfathomable reason' | |
'X::Sequence::Deduction' => method { | |
$!from ?? "Unable to deduce arithmetic or geometric sequence from: $!from\nDid you really mean '..'?" | |
!! 'Unable to deduce sequence for some unfathomable reason' | |
}, | |
# Class: X::Sequence::Endpoint | |
# Status: TO DO | |
# Original Code: | |
# "Incompatible endpoint for sequence: " | |
# ~ $!from.raku | |
# ~ " ... " | |
# ~ $!endpoint.raku | |
'X::Sequence::Endpoint' => method { | |
"Incompatible endpoint for sequence: " | |
~ $!from.raku | |
~ " ... " | |
~ $!endpoint.raku | |
}, | |
# Class: X::Set::Coerce | |
# Status: TO DO | |
# Original Code: | |
# "Invalid $.target string '$.invalid-str'; use $.format instead"; | |
'X::Set::Coerce' => method { | |
"Invalid $.target string '$.invalid-str'; use $.format instead"; | |
}, | |
# Class: X::Signature::NameClash | |
# Status: TO DO | |
# Original Code: | |
# "Name $.name used for more than one named parameter"; | |
'X::Signature::NameClash' => method { | |
"Name $.name used for more than one named parameter"; | |
}, | |
# Class: X::Signature::Placeholder | |
# Status: TO DO | |
# Original Code: | |
# "Placeholder variable '$.placeholder' cannot override existing signature"; | |
'X::Signature::Placeholder' => method { | |
"Placeholder variable '$.placeholder' cannot override existing signature"; | |
}, | |
# Class: X::Str::Match::x | |
# Status: TO DO | |
# Original Code: | |
# "in Str.match, got invalid value of type {$.got.^name} for :x, must be Int or Range" | |
'X::Str::Match::x' => method { | |
"in Str.match, got invalid value of type {$.got.^name} for :x, must be Int or Range" | |
}, | |
# Class: X::Str::Numeric | |
# Status: TO DO | |
# Original Code: | |
# "Cannot convert string to number: $.reason $.source-indicator"; | |
'X::Str::Numeric' => method { | |
"Cannot convert string to number: $.reason $.source-indicator"; | |
}, | |
# Class: X::Str::Sprintf::Directives::BadType | |
# Status: TO DO | |
# Original Code: | |
# $.expected | |
# ?? "Directive $.directive expected a $.expected value, not a $.type ({Rakudo::Internals.SHORT-STRING: $.value[0]})" | |
# !! "Directive $.directive not applicable for value of type $.type ({Rakudo::Internals.SHORT-STRING: $.value[0]})" | |
'X::Str::Sprintf::Directives::BadType' => method { | |
$.expected | |
?? "Directive $.directive expected a $.expected value, not a $.type ({Rakudo::Internals.SHORT-STRING: $.value[0]})" | |
!! "Directive $.directive not applicable for value of type $.type ({Rakudo::Internals.SHORT-STRING: $.value[0]})" | |
}, | |
# Class: X::Str::Sprintf::Directives::Count | |
# Status: TO DO | |
# Original Code: | |
# my $msg = "Your printf-style directives specify "; | |
# | |
# if $.args-used == 1 { | |
# $msg ~= "1 argument, but "; | |
# } | |
# else { | |
# $msg ~= "$.args-used arguments, but "; | |
# } | |
# | |
# if $.args-have < 1 { | |
# $msg ~= "no argument was"; | |
# } | |
# else { | |
# if $.args-have == 1 { | |
# $msg ~= "1 argument was"; | |
# } | |
# else { | |
# # too many args | |
# $msg ~= "$.args-have arguments were"; | |
# } | |
# } | |
# $msg ~= " supplied."; | |
# | |
# if $.args-used > $.args-have { | |
# $msg ~= "\nAre you using an interpolated '\$'?"; | |
# } | |
# | |
# $msg; | |
'X::Str::Sprintf::Directives::Count' => method { | |
my $msg = "Your printf-style directives specify "; | |
if $.args-used == 1 { | |
$msg ~= "1 argument, but "; | |
} | |
else { | |
$msg ~= "$.args-used arguments, but "; | |
} | |
if $.args-have < 1 { | |
$msg ~= "no argument was"; | |
} | |
else { | |
if $.args-have == 1 { | |
$msg ~= "1 argument was"; | |
} | |
else { | |
# too many args | |
$msg ~= "$.args-have arguments were"; | |
} | |
} | |
$msg ~= " supplied."; | |
if $.args-used > $.args-have { | |
$msg ~= "\nAre you using an interpolated '\$'?"; | |
} | |
$msg; | |
}, | |
# Class: X::Str::Sprintf::Directives::Unsupported | |
# Status: TO DO | |
# Original Code: | |
# "Directive $.directive is not valid in sprintf format sequence $.sequence" | |
'X::Str::Sprintf::Directives::Unsupported' => method { | |
"Directive $.directive is not valid in sprintf format sequence $.sequence" | |
}, | |
# Class: X::Str::Subst::Adverb | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use :$.name adverb in Str.subst, got $.got" | |
'X::Str::Subst::Adverb' => method { | |
"Cannot use :$.name adverb in Str.subst, got $.got" | |
}, | |
# Class: X::Str::Trans::IllegalKey | |
# Status: TO DO | |
# Original Code: | |
# "Only Pair objects are allowed as arguments to Str.trans, got {$.got.^name}"; | |
'X::Str::Trans::IllegalKey' => method { | |
"Only Pair objects are allowed as arguments to Str.trans, got {$.got.^name}"; | |
}, | |
# Class: X::Subscript::Negative | |
# Status: TO DO | |
# Original Code: | |
# "Calculated index ({$.index}) is negative, but {$.type.^name} allows only 0-based indexing"; | |
'X::Subscript::Negative' => method { | |
"Calculated index ({$.index}) is negative, but {$.type.^name} allows only 0-based indexing"; | |
}, | |
# Class: X::Syntax::AddCategorical::TooManyParts | |
# Status: TO DO | |
# Original Code: | |
# "Too many symbols provided for categorical of type $.category; needs only $.needs" | |
'X::Syntax::AddCategorical::TooManyParts' => method { | |
"Too many symbols provided for categorical of type $.category; needs only $.needs" | |
}, | |
# Class: X::Syntax::Adverb | |
# Status: TO DO | |
# Original Code: | |
# "You can't adverb " ~ $.what | |
'X::Syntax::Adverb' => method { | |
"You can't adverb " ~ $.what | |
}, | |
# Class: X::Syntax::Argument::MOPMacro | |
# Status: TO DO | |
# Original Code: | |
# "Can only supply an initialization value for a role if it has a single public attribute, but this is not the case for '{$.role.^name}'" | |
'X::Syntax::Argument::MOPMacro' => method { | |
"Can only supply an initialization value for a role if it has a single public attribute, but this is not the case for '{$.role.^name}'" | |
}, | |
# Class: X::Syntax::Augment::WithoutMonkeyTyping | |
# Status: TO DO | |
# Original Code: | |
# "Cannot put adverbs on a typename when augmenting" | |
'X::Syntax::Augment::WithoutMonkeyTyping' => method { | |
"Cannot put adverbs on a typename when augmenting" | |
}, | |
# Class: X::Syntax::BlockGobbled | |
# Status: TO DO | |
# Original Code: | |
# my $looks_like_type = $.what ~~ /'::' | <[A..Z]><[a..z]>+/; | |
# $.what ~~ /^'is '/ | |
# ?? "Trait '$.what' needs whitespace before block" | |
# !! "{ $.what ?? "Function '$.what'" !! 'Expression' } needs parens to avoid gobbling block" ~ | |
# ($looks_like_type ?? " (or perhaps it's a class that's not declared or available in this scope?)" !! ""); | |
'X::Syntax::BlockGobbled' => method { | |
my $looks_like_type = $.what ~~ /'::' | <[A..Z]><[a..z]>+/; | |
$.what ~~ /^'is '/ | |
?? "Trait '$.what' needs whitespace before block" | |
!! "{ $.what ?? "Function '$.what'" !! 'Expression' } needs parens to avoid gobbling block" ~ | |
($looks_like_type ?? " (or perhaps it's a class that's not declared or available in this scope?)" !! ""); | |
}, | |
# Class: X::Syntax::CannotMeta | |
# Status: TO DO | |
# Original Code: | |
# "Cannot $.meta $.operator because $.dba operators are $.reason"; | |
'X::Syntax::CannotMeta' => method { | |
"Cannot $.meta $.operator because $.dba operators are $.reason"; | |
}, | |
# Class: X::Syntax::Coercer::TooComplex | |
# Status: TO DO | |
# Original Code: | |
# 'Coercer is too complex. Only type objects, with optional type' | |
# ~ " smileys, or empty parentheses, implying 'Any', are supported." | |
'X::Syntax::Coercer::TooComplex' => method { | |
'Coercer is too complex. Only type objects, with optional type' | |
~ " smileys, or empty parentheses, implying 'Any', are supported." | |
}, | |
# Class: X::Syntax::Comment::Embedded | |
# Status: TO DO | |
# Original Code: | |
# "Opening bracket required for #` comment" | |
'X::Syntax::Comment::Embedded' => method { | |
"Opening bracket required for #` comment" | |
}, | |
# Class: X::Syntax::ConditionalOperator::PrecedenceTooLoose | |
# Status: TO DO | |
# Original Code: | |
# "Precedence of $.operator is too loose to use inside ?? !!; please parenthesize" | |
'X::Syntax::ConditionalOperator::PrecedenceTooLoose' => method { | |
"Precedence of $.operator is too loose to use inside ?? !!; please parenthesize" | |
}, | |
# Class: X::Syntax::ConditionalOperator::SecondPartGobbled | |
# Status: TO DO | |
# Original Code: | |
# "Your !! was gobbled by the expression in the middle; please parenthesize" | |
'X::Syntax::ConditionalOperator::SecondPartGobbled' => method { | |
"Your !! was gobbled by the expression in the middle; please parenthesize" | |
}, | |
# Class: X::Syntax::ConditionalOperator::SecondPartInvalid | |
# Status: TO DO | |
# Original Code: | |
# "Please use !! rather than $.second-part" | |
'X::Syntax::ConditionalOperator::SecondPartInvalid' => method { | |
"Please use !! rather than $.second-part" | |
}, | |
# Class: X::Syntax::Confused | |
# Status: TO DO | |
# Original Code: | |
# $.reason eq 'unknown' ?? 'Confused' !! $.reason | |
'X::Syntax::Confused' => method { | |
$.reason eq 'unknown' ?? 'Confused' !! $.reason | |
}, | |
# Class: X::Syntax::DuplicatedPrefix | |
# Status: TO DO | |
# Original Code: | |
# my $prefix = substr($.prefixes,0,1); | |
# "Expected a term, but found either infix $.prefixes or redundant prefix $prefix\n" | |
# ~ " (to suppress this message, please use a space like $prefix $prefix)"; | |
'X::Syntax::DuplicatedPrefix' => method { | |
my $prefix = substr($.prefixes,0,1); | |
"Expected a term, but found either infix $.prefixes or redundant prefix $prefix\n" | |
~ " (to suppress this message, please use a space like $prefix $prefix)"; | |
}, | |
# Class: X::Syntax::Extension::Category | |
# Status: TO DO | |
# Original Code: | |
# "Cannot add tokens of category '$.category'"; | |
'X::Syntax::Extension::Category' => method { | |
"Cannot add tokens of category '$.category'"; | |
}, | |
# Class: X::Syntax::Extension::Null | |
# Status: TO DO | |
# Original Code: | |
# "Null operator is not allowed"; | |
'X::Syntax::Extension::Null' => method { | |
"Null operator is not allowed"; | |
}, | |
# Class: X::Syntax::Extension::SpecialForm | |
# Status: TO DO | |
# Original Code: | |
# "Cannot override $.category operator '$.opname', as it is a special form " ~ | |
# "handled directly by the compiler" ~ ($!hint ?? "\n$!hint" !! "") | |
'X::Syntax::Extension::SpecialForm' => method { | |
"Cannot override $.category operator '$.opname', as it is a special form " ~ | |
"handled directly by the compiler" ~ ($!hint ?? "\n$!hint" !! "") | |
}, | |
# Class: X::Syntax::Extension::TooComplex | |
# Status: TO DO | |
# Original Code: | |
# "Colon pair value '$.name' too complex to use in name"; | |
'X::Syntax::Extension::TooComplex' => method { | |
"Colon pair value '$.name' too complex to use in name"; | |
}, | |
# Class: X::Syntax::InfixInTermPosition | |
# Status: TO DO | |
# Original Code: | |
# my $infix := $!infix.trim; | |
# "Preceding context expects a term, but found infix $infix instead." | |
# ~ ( | |
# $.post && $.post.starts-with('end ') | |
# ?? "\nDid you forget '=begin $.post.substr(4)' Pod marker?" | |
# !! "\nDid you make a mistake in Pod syntax?" | |
# if $infix eq '=' | |
# ) | |
'X::Syntax::InfixInTermPosition' => method { | |
my $infix := $!infix.trim; | |
"Preceding context expects a term, but found infix $infix instead." | |
~ ( | |
$.post && $.post.starts-with('end ') | |
?? "\nDid you forget '=begin $.post.substr(4)' Pod marker?" | |
!! "\nDid you make a mistake in Pod syntax?" | |
if $infix eq '=' | |
) | |
}, | |
# Class: X::Syntax::KeywordAsFunction | |
# Status: TO DO | |
# Original Code: | |
# "Parent class specification is probably missing some whitespace. Found '$.type is $.parent\{ ...', which tries to specify a parent with a '$.what'. You probably meant '$.type is $.parent \{ ...'.".naive-word-wrapper | |
'X::Syntax::KeywordAsFunction' => method { | |
"Parent class specification is probably missing some whitespace. Found '$.type is $.parent\{ ...', which tries to specify a parent with a '$.what'. You probably meant '$.type is $.parent \{ ...'.".naive-word-wrapper | |
}, | |
# Class: X::Syntax::Malformed | |
# Status: TO DO | |
# Original Code: | |
# "Malformed $.what" | |
'X::Syntax::Malformed' => method { | |
"Malformed $.what" | |
}, | |
# Class: X::Syntax::Malformed::Elsif | |
# Status: TO DO | |
# Original Code: | |
# qq{In Raku, please use "elsif' instead of "$.what"} | |
'X::Syntax::Malformed::Elsif' => method { | |
qq{In Raku, please use "elsif' instead of "$.what"} | |
}, | |
# Class: X::Syntax::Missing | |
# Status: TO DO | |
# Original Code: | |
# "Missing $.what" | |
'X::Syntax::Missing' => method { | |
"Missing $.what" | |
}, | |
# Class: X::Syntax::Name::Null | |
# Status: TO DO | |
# Original Code: | |
# 'Name component may not be null'; | |
'X::Syntax::Name::Null' => method { | |
'Name component may not be null'; | |
}, | |
# Class: X::Syntax::NegatedPair | |
# Status: TO DO | |
# Original Code: | |
# "Argument not allowed on negated pair with key '$.key'" | |
'X::Syntax::NegatedPair' => method { | |
"Argument not allowed on negated pair with key '$.key'" | |
}, | |
# Class: X::Syntax::NonAssociative | |
# Status: TO DO | |
# Original Code: | |
# "Operators '$.left' and '$.right' are non-associative and require parentheses"; | |
'X::Syntax::NonAssociative' => method { | |
"Operators '$.left' and '$.right' are non-associative and require parentheses"; | |
}, | |
# Class: X::Syntax::NonListAssociative | |
# Status: TO DO | |
# Original Code: | |
# "Only identical operators may be list associative; since '$.left' and '$.right' differ, they are non-associative and you need to clarify with parentheses"; | |
'X::Syntax::NonListAssociative' => method { | |
"Only identical operators may be list associative; since '$.left' and '$.right' differ, they are non-associative and you need to clarify with parentheses"; | |
}, | |
# Class: X::Syntax::P5 | |
# Status: TO DO | |
# Original Code: | |
# 'This appears to be Perl code' | |
'X::Syntax::P5' => method { | |
'This appears to be Perl code' | |
}, | |
# Class: X::Syntax::Perl5Var | |
# Status: TO DO | |
# Original Code: | |
# my $name = $!name; | |
# my $v = $name ~~ m/ <[ $ @ % & ]> [ \^ <[ A..Z ]> | \W ] /; | |
# my $sugg = nqp::atkey($m,~$v); | |
# if $name eq '$#' { | |
# # Currently only `$#` var has this identifier business handling. | |
# # Should generalize the logic if we get more of stuff like this. | |
# $name ~= $!identifier-name; | |
# $sugg = '@' ~ $!identifier-name ~ '.end'; | |
# } | |
# $v | |
# ?? $sugg | |
# ?? "Unsupported use of $name variable; in Raku please use $sugg" | |
# !! "Unsupported use of $name variable" | |
# !! 'Weird unrecognized variable name: ' ~ $name; | |
# } | |
#} | |
# | |
#my class X::Syntax::Self::WithoutObject does X::Syntax { | |
# method message() { "'self' used where no object is available" } | |
#} | |
#my class X::Syntax::VirtualCall does X::Syntax { | |
# has $.call; | |
# method message() { "Virtual method call $.call may not be used on partially constructed object (maybe you mean {$.call.subst('.','!')} for direct attribute access here?)" } | |
#} | |
#my class X::Syntax::NoSelf does X::Syntax { | |
# has $.variable; | |
# method message() { "Variable $.variable used where no 'self' is available" } | |
#} | |
# | |
#my class X::Syntax::Number::RadixOutOfRange does X::Syntax { | |
# has $.radix; | |
# method message() { "Radix $.radix out of range (allowed: 2..36)" } | |
#} | |
# | |
#my class X::Syntax::Number::IllegalDecimal does X::Syntax { | |
# method message() { "Decimal point must be followed by digit" } | |
#} | |
# | |
#my class X::Syntax::Number::LiteralType does X::Syntax { | |
# has $.varname; | |
# has $.vartype; | |
# has $.value; | |
# has $.valuetype; | |
# has $.suggestiontype; | |
# has $.native; | |
# | |
# method message() { | |
# my $vartype := $!vartype.WHAT.^name; | |
# my $conversionmethod := $vartype; | |
# $vartype := $vartype.lc if $.native; | |
# my $vt := $!value.^name; | |
# my $value := $vt eq "IntStr" || $vt eq "NumStr" || $vt eq "RatStr" || $vt eq "ComplexStr" | |
# ?? $!value.Str | |
# !! $!value.raku; | |
# my $val = "Cannot assign a literal of type {$.valuetype} ($value) to { $.native ?? "a native" !! "a" } variable of type $vartype. You can declare the variable to be of type $.suggestiontype, or try to coerce the value with { $value ~ '.' ~ $conversionmethod } or $conversionmethod\($value\)"; | |
# try $val ~= ", or just write the value as " ~ $!value."$vartype"().raku; | |
# $val; | |
'X::Syntax::Perl5Var' => method { | |
my $name = $!name; | |
my $v = $name ~~ m/ <[ $ @ % & ]> [ \^ <[ A..Z ]> | \W ] /; | |
my $sugg = nqp::atkey($m,~$v); | |
if $name eq '$#' { | |
# Currently only `$#` var has this identifier business handling. | |
# Should generalize the logic if we get more of stuff like this. | |
$name ~= $!identifier-name; | |
$sugg = '@' ~ $!identifier-name ~ '.end'; | |
} | |
$v | |
?? $sugg | |
?? "Unsupported use of $name variable; in Raku please use $sugg" | |
!! "Unsupported use of $name variable" | |
!! 'Weird unrecognized variable name: ' ~ $name; | |
} | |
} | |
my class X::Syntax::Self::WithoutObject does X::Syntax { | |
method message() { "'self' used where no object is available" } | |
} | |
my class X::Syntax::VirtualCall does X::Syntax { | |
has $.call; | |
method message() { "Virtual method call $.call may not be used on partially constructed object (maybe you mean {$.call.subst('.','!')} for direct attribute access here?)" } | |
} | |
my class X::Syntax::NoSelf does X::Syntax { | |
has $.variable; | |
method message() { "Variable $.variable used where no 'self' is available" } | |
} | |
my class X::Syntax::Number::RadixOutOfRange does X::Syntax { | |
has $.radix; | |
method message() { "Radix $.radix out of range (allowed: 2..36)" } | |
} | |
my class X::Syntax::Number::IllegalDecimal does X::Syntax { | |
method message() { "Decimal point must be followed by digit" } | |
} | |
my class X::Syntax::Number::LiteralType does X::Syntax { | |
has $.varname; | |
has $.vartype; | |
has $.value; | |
has $.valuetype; | |
has $.suggestiontype; | |
has $.native; | |
method message() { | |
my $vartype := $!vartype.WHAT.^name; | |
my $conversionmethod := $vartype; | |
$vartype := $vartype.lc if $.native; | |
my $vt := $!value.^name; | |
my $value := $vt eq "IntStr" || $vt eq "NumStr" || $vt eq "RatStr" || $vt eq "ComplexStr" | |
?? $!value.Str | |
!! $!value.raku; | |
my $val = "Cannot assign a literal of type {$.valuetype} ($value) to { $.native ?? "a native" !! "a" } variable of type $vartype. You can declare the variable to be of type $.suggestiontype, or try to coerce the value with { $value ~ '.' ~ $conversionmethod } or $conversionmethod\($value\)"; | |
try $val ~= ", or just write the value as " ~ $!value."$vartype"().raku; | |
$val; | |
}, | |
# Class: X::Syntax::Pod::DeclaratorLeading | |
# Status: TO DO | |
# Original Code: | |
# "Opening bracket required for #| declarator block" | |
'X::Syntax::Pod::DeclaratorLeading' => method { | |
"Opening bracket required for #| declarator block" | |
}, | |
# Class: X::Syntax::Pod::DeclaratorTrailing | |
# Status: TO DO | |
# Original Code: | |
# "Opening bracket required for #= declarator block" | |
'X::Syntax::Pod::DeclaratorTrailing' => method { | |
"Opening bracket required for #= declarator block" | |
}, | |
# Class: X::Syntax::Regex::Adverb | |
# Status: TO DO | |
# Original Code: | |
# "Adverb $.adverb not allowed on $.construct" | |
'X::Syntax::Regex::Adverb' => method { | |
"Adverb $.adverb not allowed on $.construct" | |
}, | |
# Class: X::Syntax::Regex::MalformedRange | |
# Status: TO DO | |
# Original Code: | |
# 'Malformed Range. If attempting to use variables for end points, ' | |
# ~ 'wrap the entire range in curly braces.' | |
'X::Syntax::Regex::MalformedRange' => method { | |
'Malformed Range. If attempting to use variables for end points, ' | |
~ 'wrap the entire range in curly braces.' | |
}, | |
# Class: X::Syntax::Regex::NullRegex | |
# Status: TO DO | |
# Original Code: | |
# 'Null regex not allowed' | |
'X::Syntax::Regex::NullRegex' => method { | |
'Null regex not allowed' | |
}, | |
# Class: X::Syntax::Regex::UnrecognizedMetachar | |
# Status: TO DO | |
# Original Code: | |
# "Unrecognized regex metacharacter $.metachar (must be quoted to match literally)" | |
'X::Syntax::Regex::UnrecognizedMetachar' => method { | |
"Unrecognized regex metacharacter $.metachar (must be quoted to match literally)" | |
}, | |
# Class: X::Syntax::Regex::UnrecognizedModifier | |
# Status: TO DO | |
# Original Code: | |
# "Unrecognized regex modifier :$.modifier" | |
'X::Syntax::Regex::UnrecognizedModifier' => method { | |
"Unrecognized regex modifier :$.modifier" | |
}, | |
# Class: X::Syntax::Regex::Unspace | |
# Status: TO DO | |
# Original Code: | |
# "Can only alias to a short name (without '::')"; | |
'X::Syntax::Regex::Unspace' => method { | |
"Can only alias to a short name (without '::')"; | |
}, | |
# Class: X::Syntax::Reserved | |
# Status: TO DO | |
# Original Code: | |
# "The $.reserved is reserved$.instead" | |
'X::Syntax::Reserved' => method { | |
"The $.reserved is reserved$.instead" | |
}, | |
# Class: X::Syntax::Signature::InvocantMarker | |
# Status: TO DO | |
# Original Code: | |
# "Can only use : as invocant marker in a signature after the first parameter" | |
'X::Syntax::Signature::InvocantMarker' => method { | |
"Can only use : as invocant marker in a signature after the first parameter" | |
}, | |
# Class: X::Syntax::Signature::InvocantNotAllowed | |
# Status: TO DO | |
# Original Code: | |
# "Can only use the : invocant marker in the signature for a method" | |
'X::Syntax::Signature::InvocantNotAllowed' => method { | |
"Can only use the : invocant marker in the signature for a method" | |
}, | |
# Class: X::Syntax::Term::MissingInitializer | |
# Status: TO DO | |
# Original Code: | |
# "Not enough symbols provided for categorical of type $.category; needs $.needs" | |
'X::Syntax::Term::MissingInitializer' => method { | |
"Not enough symbols provided for categorical of type $.category; needs $.needs" | |
}, | |
# Class: X::Syntax::Type::Adverb | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use adverb $.adverb on a type name (only 'ver', 'auth' and 'api' are understood)" | |
'X::Syntax::Type::Adverb' => method { | |
"Cannot use adverb $.adverb on a type name (only 'ver', 'auth' and 'api' are understood)" | |
}, | |
# Class: X::Syntax::UnlessElse | |
# Status: TO DO | |
# Original Code: | |
# qq|"unless" does not take "$!keyword", please rewrite using "if"| | |
'X::Syntax::UnlessElse' => method { | |
qq|"unless" does not take "$!keyword", please rewrite using "if"| | |
}, | |
# Class: X::Syntax::Variable::BadType | |
# Status: TO DO | |
# Original Code: | |
# my $what = ~$!type.HOW.WHAT.^name.match(/ .* '::' <(.*)> HOW/) // 'Namespace'; | |
# "$what '$!type.^name()' is insufficiently type-like to qualify a variable. Did you mean 'class'?".naive-word-wrapper | |
'X::Syntax::Variable::BadType' => method { | |
my $what = ~$!type.HOW.WHAT.^name.match(/ .* '::' <(.*)> HOW/) // 'Namespace'; | |
"$what '$!type.^name()' is insufficiently type-like to qualify a variable. Did you mean 'class'?".naive-word-wrapper | |
}, | |
# Class: X::Syntax::Variable::ConflictingTypes | |
# Status: TO DO | |
# Original Code: | |
# "$!inner.^name() not allowed here; variable list already declared with type $!outer.^name()" | |
'X::Syntax::Variable::ConflictingTypes' => method { | |
"$!inner.^name() not allowed here; variable list already declared with type $!outer.^name()" | |
}, | |
# Class: X::Syntax::Variable::IndirectDeclaration | |
# Status: TO DO | |
# Original Code: | |
# 'Cannot declare a variable by indirect name (use a hash instead?)' | |
'X::Syntax::Variable::IndirectDeclaration' => method { | |
'Cannot declare a variable by indirect name (use a hash instead?)' | |
}, | |
# Class: X::Syntax::Variable::Initializer | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use variable $!name in declaration to initialize itself" | |
'X::Syntax::Variable::Initializer' => method { | |
"Cannot use variable $!name in declaration to initialize itself" | |
}, | |
# Class: X::Syntax::Variable::Match | |
# Status: TO DO | |
# Original Code: | |
# 'Cannot declare a match variable' | |
'X::Syntax::Variable::Match' => method { | |
'Cannot declare a match variable' | |
}, | |
# Class: X::Syntax::Variable::Numeric | |
# Status: TO DO | |
# Original Code: | |
# "Cannot declare a numeric $.what" | |
'X::Syntax::Variable::Numeric' => method { | |
"Cannot declare a numeric $.what" | |
}, | |
# Class: X::Syntax::Variable::Twigil | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use a '$.twigil' twigil on a '$.scope $.name' $.what$.additional.".naive-word-wrapper | |
'X::Syntax::Variable::Twigil' => method { | |
"Cannot use a '$.twigil' twigil on a '$.scope $.name' $.what$.additional.".naive-word-wrapper | |
}, | |
# Class: X::Syntax::WithoutElse | |
# Status: TO DO | |
# Original Code: | |
# qq|"without" does not take "$!keyword", please rewrite using "with"| | |
'X::Syntax::WithoutElse' => method { | |
qq|"without" does not take "$!keyword", please rewrite using "with"| | |
}, | |
# Class: X::TooLateForREPR | |
# Status: TO DO | |
# Original Code: | |
# "Cannot change REPR of $!type.^name() now (must be set at initial declaration)"; | |
'X::TooLateForREPR' => method { | |
"Cannot change REPR of $!type.^name() now (must be set at initial declaration)"; | |
}, | |
# Class: X::TooManyDimensions | |
# Status: TO DO | |
# Original Code: | |
# "Cannot $.operation a $.needed-dimensions dimension array with $.got-dimensions dimensions" | |
'X::TooManyDimensions' => method { | |
"Cannot $.operation a $.needed-dimensions dimension array with $.got-dimensions dimensions" | |
}, | |
# Class: X::Trait::NotOnNative | |
# Status: TO DO | |
# Original Code: | |
# "Can't use trait '$.type $.subtype' on a native" | |
# ~ ( $.native ?? " $.native." !! "." ); | |
'X::Trait::NotOnNative' => method { | |
"Can't use trait '$.type $.subtype' on a native" | |
~ ( $.native ?? " $.native." !! "." ); | |
}, | |
# Class: X::Trait::Scope | |
# Status: TO DO | |
# Original Code: | |
# "Can't apply trait '$.type $.subtype' on a $.scope scoped $.declaring." | |
# ~ ( $.supported ?? " Only {$.supported.join(' and ')} scoped {$.declaring}s are supported." !! '' ); | |
'X::Trait::Scope' => method { | |
"Can't apply trait '$.type $.subtype' on a $.scope scoped $.declaring." | |
~ ( $.supported ?? " Only {$.supported.join(' and ')} scoped {$.declaring}s are supported." !! '' ); | |
}, | |
# Class: X::Trait::Unknown | |
# Status: TO DO | |
# Original Code: | |
# "Can't use unknown trait '{ | |
# try { $.type } // "unknown type" | |
# }' -> '{ | |
# try { $.subtype } // "unknown subtype" | |
# }' in a$.declaring declaration." | |
'X::Trait::Unknown' => method { | |
"Can't use unknown trait '{ | |
try { $.type } // "unknown type" | |
}' -> '{ | |
try { $.subtype } // "unknown subtype" | |
}' in a$.declaring declaration." | |
}, | |
# Class: X::TypeCheck::Assignment | |
# Status: TO DO | |
# Original Code: | |
# "$.redispatcher is not in the dynamic scope of a dispatcher"; | |
'X::TypeCheck::Assignment' => method { | |
"$.redispatcher is not in the dynamic scope of a dispatcher"; | |
}, | |
# Class: X::TypeCheck::Binding | |
# Status: TO DO | |
# Original Code: | |
# my $to = $.symbol.defined && $.symbol ne '$' | |
# ?? " to '$.symbol'" | |
# !! ""; | |
# my $expected = nqp::eqaddr(self.expected, self.got) | |
# ?? "expected type $.expectedn cannot be itself" | |
# !! "expected $.expectedn but got $.gotn"; | |
# self.priors() ~ "Type check failed in $.operation$to; $expected"; | |
'X::TypeCheck::Binding' => method { | |
my $to = $.symbol.defined && $.symbol ne '$' | |
?? " to '$.symbol'" | |
!! ""; | |
my $expected = nqp::eqaddr(self.expected, self.got) | |
?? "expected type $.expectedn cannot be itself" | |
!! "expected $.expectedn but got $.gotn"; | |
self.priors() ~ "Type check failed in $.operation$to; $expected"; | |
}, | |
# Class: X::TypeCheck::Binding::Parameter | |
# Status: TO DO | |
# Original Code: | |
# my $to = $.symbol.defined && $.symbol ne '$' | |
# ?? " to parameter '$.symbol'" | |
# !! " to anonymous parameter"; | |
# my $expected = nqp::eqaddr(self.expected, self.got) | |
# ?? "expected type $.expectedn cannot be itself" | |
# !! "expected $.expectedn but got $.gotn"; | |
# my $what-check = $.constraint ?? 'Constraint type' !! 'Type'; | |
# self.priors() ~ "$what-check check failed in $.operation$to; $expected"; | |
'X::TypeCheck::Binding::Parameter' => method { | |
my $to = $.symbol.defined && $.symbol ne '$' | |
?? " to parameter '$.symbol'" | |
!! " to anonymous parameter"; | |
my $expected = nqp::eqaddr(self.expected, self.got) | |
?? "expected type $.expectedn cannot be itself" | |
!! "expected $.expectedn but got $.gotn"; | |
my $what-check = $.constraint ?? 'Constraint type' !! 'Type'; | |
self.priors() ~ "$what-check check failed in $.operation$to; $expected"; | |
}, | |
# Class: X::TypeCheck::Return | |
# Status: TO DO | |
# Original Code: | |
# my $expected = nqp::eqaddr(self.expected, self.got) | |
# ?? "expected return type $.expectedn cannot be itself " ~ | |
# "(perhaps $.operation a :D type object?)" | |
# !! "expected $.expectedn but got $.gotn"; | |
# self.priors() ~ | |
# "Type check failed for return value; $expected"; | |
'X::TypeCheck::Return' => method { | |
my $expected = nqp::eqaddr(self.expected, self.got) | |
?? "expected return type $.expectedn cannot be itself " ~ | |
"(perhaps $.operation a :D type object?)" | |
!! "expected $.expectedn but got $.gotn"; | |
self.priors() ~ | |
"Type check failed for return value; $expected"; | |
}, | |
# Class: X::Undeclared | |
# Status: TO DO | |
# Original Code: | |
# my $message := "$.what '$.symbol' is not declared"; | |
# if [email protected] == 1 { | |
# $message := "$message. Did you mean '@.suggestions[0]'?"; | |
# } elsif [email protected] > 1 { | |
# $message := "$message. Did you mean any of these: { @.suggestions.map( { "'$_'" } ).join(", ") }?"; | |
# } | |
# $message.naive-word-wrapper | |
'X::Undeclared' => method { | |
my $message := "$.what '$.symbol' is not declared"; | |
if [email protected] == 1 { | |
$message := "$message. Did you mean '@.suggestions[0]'?"; | |
} elsif [email protected] > 1 { | |
$message := "$message. Did you mean any of these: { @.suggestions.map( { "'$_'" } ).join(", ") }?"; | |
} | |
$message.naive-word-wrapper | |
}, | |
# Class: X::Undeclared::Symbols | |
# Status: TO DO | |
# Original Code: | |
# ("Redeclaration of $.what '$.symbol'" | |
# ~ (" $.postfix" if $.postfix) | |
# ~ ($.what eq 'routine' | |
# ?? ". Did you mean to declare a multi-sub?" | |
# !! ".") | |
# ).naive-word-wrapper | |
'X::Undeclared::Symbols' => method { | |
("Redeclaration of $.what '$.symbol'" | |
~ (" $.postfix" if $.postfix) | |
~ ($.what eq 'routine' | |
?? ". Did you mean to declare a multi-sub?" | |
!! ".") | |
).naive-word-wrapper | |
}, | |
# Class: X::UnitScope::Invalid | |
# Status: TO DO | |
# Original Code: | |
# "A unit-scoped $.what definition is not allowed $.where;\n$!suggestion" | |
'X::UnitScope::Invalid' => method { | |
"A unit-scoped $.what definition is not allowed $.where;\n$!suggestion" | |
}, | |
# Class: X::UnitScope::TooLate | |
# Status: TO DO | |
# Original Code: | |
# "Too late for unit-scoped $.what definition;\n" | |
# ~ "Please use the block form." | |
'X::UnitScope::TooLate' => method { | |
"Too late for unit-scoped $.what definition;\n" | |
~ "Please use the block form." | |
}, | |
# Class: X::WheneverOutOfScope | |
# Status: TO DO | |
# Original Code: | |
# "Cannot have a 'whenever' block outside the scope of a 'supply' or 'react' block" | |
'X::WheneverOutOfScope' => method { | |
"Cannot have a 'whenever' block outside the scope of a 'supply' or 'react' block" | |
}, | |
# Class: X::Worry::P5::Reference | |
# Status: TO DO | |
# Original Code: | |
# "Cannot use '$.type $.subtype' on $.declaring '$.name'." | |
'X::Worry::P5::Reference' => method { | |
"Cannot use '$.type $.subtype' on $.declaring '$.name'." | |
}, | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment