Skip to content

Commit

Permalink
Make Num coercer demand definite invocant
Browse files Browse the repository at this point in the history
This changes the error message reported back to user from a cryptic
'Cannot look up attributes in a <...> type object' to more correct
'Invocant of method 'Num' must be an object instance of type 'Rational',
not a type object of type 'Rat'.  Did you forget a '.new'?'
  • Loading branch information
vrurg committed Nov 29, 2020
1 parent 1b26983 commit a75b3fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core.c/Rational.pm6
Expand Up @@ -65,7 +65,7 @@ my role Rational[::NuT = Int, ::DeT = ::("NuT")] does Real {

method nude() { $!numerator, $!denominator }

method Num(--> Num:D) {
method Num(Rational:D: --> Num:D) {
nqp::p6box_n(nqp::div_In($!numerator,$!denominator))
}

Expand Down

0 comments on commit a75b3fa

Please sign in to comment.