Closed mrodz closed 9 months ago
class A { fn assoc(self) -> Self? { return self } } a = A() type B A type C B take_a = fn(in: C) { print in } take_a((a.assoc()) or A())
[ Trace ] INIT Virtual Stack at MODULE [ Debug ] pre-walk ".\\try_to_crash.ms" [ Debug ] registering new file ".\\try_to_crash.ms" (File { declarations: RefCell { value: [] }, location: ".\\try_to_crash.mmm", exports: RefCell { value: [] }, public_types: RefCell { value: {} }, compiled: CompilationLock(Cell { value: false }) }) -- Adding to: [] [ Trace ] Virtual Stack PUSH: Class <UNKNOWN> -> No [ Trace ] + assoc: fn() -> Self? [ Trace ] Virtual Stack POP [ Trace ] in scope Module, adding type A = A [ Trace ] formally aliasing `B` = A [ Trace ] + B: A [ Trace ] in scope Module, adding type B = B [ Trace ] Gen. mod ".\\try_to_crash.ms" -- adding type TypeAlias [ Trace ] formally aliasing `C` = B [ Trace ] in scope Module, adding type C = C [ Trace ] Gen. mod ".\\try_to_crash.ms" -- adding type TypeAlias [ Trace ] Gen. mod ".\\try_to_crash.ms" -- skipping value [ Info ] DONE preloading module .\try_to_crash.ms [ Info ] + mod "./try_to_crash.ms" ModuleType { exported_members: RefCell { value: [] }, public_types: RefCell { value: {} }, name: ".\\try_to_crash.ms" } [ Info ] + finished preload of ".\\try_to_crash.ms" [ Trace ] Virtual Stack PUSH: Class <UNKNOWN> -> No [ Trace ] + assoc: fn() -> Self? [ Trace ] + A: A [ Trace ] class A { ... } [ Trace ] Virtual Stack PUSH: fn(???) -> Should(Optional(Some(ClassSelf))) [ Trace ] + self: Self [ Trace ] Virtual Stack POP [ Trace ] Virtual Stack POP [ Trace ] in scope Module, adding type A = A [ Trace ] + A: A [ Trace ] + a: A [ Trace ] formally aliasing `B` = A [ Trace ] + B: A [ Trace ] in scope Module, adding type B = B [ Trace ] formally aliasing `C` = B [ Trace ] in scope Module, adding type C = C [ Trace ] Virtual Stack PUSH: fn(???) -> Void [ Trace ] + in: C [ Trace ] Virtual Stack POP [ Trace ] + take_a: fn(C) [ Error ] ./try_to_crash.ms:16:23 > The `or` portion of this unwrap must yield `Self`, but `A` was found > "A()" --> ./try_to_crash.ms:16:23 | 16 | take_a((a.assoc()) or A()) | ^-^ | = The `or` portion of this unwrap must yield `Self`, but `A` was found Error: Did not compile successfully (1 Error)
Allow this or fallback, because it is correct.
or
ClassSelf
eq_complex()
Snippet Responsible
Stack Trace of Error
Expected Behavior
Allow this
or
fallback, because it is correct.Any ideas where MScript breaks?
Brain Dump (Optional)
ClassSelf
is not being handled by the typecheckereq_complex()
correctly