motoko icon indicating copy to clipboard operation
motoko copied to clipboard

bug: contextual dot resolution masks effects

Open crusso opened this issue 2 months ago • 0 comments

Alexandru Uta 10:26 AM guys, I’m trying to help Martin port a piece of code like this: Float.equal(await Solution.volumeSphere(1.0), 4.188790, epsilon); 10:27 to (await Solution.volumeSphere(1.0)).equal(4.188790, epsilon); 10:27 and the compiler gives an error

Christoph Hegemann 10:28 AM let solution = await Solution.volumeSphere(1.0); solution.equal(4.188790, epsilon); I'd probably try that

Alexandru Uta 10:28 AM if I take the await out like let x = await Solution.volumeSphere(1.0); x.equal(...) 10:28 it works

Christoph Hegemann 10:28 AM What's the error?

Alexandru Uta 10:28 AM Ill-typed intermediate code after Desugaring (use -v to see dumped IR): /home/alexuta/code/motoko-training/.test-files/solution.test.mo:9.54-9.73: IR type error [M0000], inferred effect not a subtype of expected effect Raised at Ir_def__Check_ir.error.(fun) in file "ir_def/check_ir.ml", line 123, characters 30-92 Called from Ir_def__Check_ir.check_exp in file "ir_def/check_ir.ml", line 425, characters 2-100 Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15 Called from Ir_def__Check_ir.check_exp in file "ir_def/check_ir.ml", line 445, characters 4-32 Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15 Called from Ir_def__Check_ir.check_exp in file "ir_def/check_ir.ml", line 445, characters 4-32 Called from Ir_def__Check_ir.check_dec in file "ir_def/check_ir.ml", line 1165, characters 4-21 Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15 Called from Ir_def__Check_ir.check_exp in file "ir_def/check_ir.ml", line 760, characters 4-22 Called from Ir_def__Check_ir.check_exp in file "ir_def/check_ir.ml", line 803, characters 4-23 Called from Ir_def__Check_ir.check_exp in file "ir_def/check_ir.ml", line 844, characters 4-40 Called from Ir_def__Check_ir.check_dec in file "ir_def/check_ir.ml", line 1165, characters 4-21 Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15 Called from Ir_def__Check_ir.check_comp_unit in file "ir_def/check_ir.ml", line 1226, characters 4-23 Called from Ir_def__Check_ir.check_prog in file "ir_def/check_ir.ml", line 1250, characters 6-28 10:28 very weird

Christoph Hegemann 10:29 AM yikes...

Alexandru Uta 10:29 AM the variable stuff just works, so I’ll do that, but I thought my eyes crossed while adding parentheses or something

Christoph Hegemann 10:29 AM I'll need to ask Claudio when he's back from the doctor. I haven't really looked at the effect stuff yet 10:31 Just for fun, does this fix it:? ((await Solution.volumeSphere(1.0)) : Float).equal(4.188790, epsilon);

Claudio Russo 10:33 AM Looks fixable. Just need to preserve the effect of the receiver expression. 10:33 Stuck on something else

crusso avatar Oct 29 '25 11:10 crusso