Vale icon indicating copy to clipboard operation
Vale copied to clipboard

Implementing mutable interface for immutable struct crashes compiler

Open lupuchard opened this issue 2 years ago • 1 comments

interface A {
	func foo(virtual a &A) int;
}

struct B imm { val int; }
impl A for B;
func foo(b &B) int { return b.val; }

This throws exception:

Exception in thread "main" scala.MatchError: CouldntFindOverrideT(...) (of class dev.vale.typing.CouldntFindOverrideT)
        at dev.vale.typing.CompilerErrorHumanizer$.humanize(CompilerErrorHumanizer.scala:34)
        at dev.vale.passmanager.PassManager$.build(PassManager.scala:263)
        at dev.vale.passmanager.PassManager$.buildAndOutput(PassManager.scala:312)
        at dev.vale.passmanager.PassManager$.main(PassManager.scala:420)
        at dev.vale.passmanager.PassManager.main(PassManager.scala)
Frontend returned error code 1, aborting.
(panic)

lupuchard avatar Jul 24 '22 14:07 lupuchard

Thanks for the bug report! I think I see what's going on here. I'm adding a test case now, and aim to have this fixed before the next minor release.

Verdagon avatar Jul 25 '22 19:07 Verdagon