I have a fraction library. There are methods “to” and “reduce” defined but the compiler on forc test fails to detect them. The errors are something like: \
202 |
203 | };
204 | let fr = Fraction::multiply(f1, f3);
| ^^^^^^^^ No method named "multiply" found for type "Fraction".
205 |
206 | fr
|
____
error
--> /home/ritik/hello_sway/fraction_sway/src/lib.sw:216:23
|
214 |
215 | fn test_create_fraction() {
216 | let f = Fraction::to(true, 7, 10);
| ^^ No method named "to" found for type "Fraction".
217 | assert(f.num == 7);
218 | assert (f.den == 10);
|
This is surprising considering I have done exactly the same thing while building the Signed Int library, but nothing went wrong there. However here, I just get such errors and I don’t get why.
Fraction Library: htt ps://github .c om/harshnambiar/fraction_sway (have to share the piecewise link because some genius thought it would be a good idea to prevent links from being shared on the forum)
PS: perchance, is Fraction a keyword already taken up by the compiler?