Results 58 comments of Chao Yang

It probably needs a new opcode to get the runtime type id from object header. It is weird with `typeof(foo) == Foo`. ```crystal class Foo end class Bar < Foo...

OK, It seems like AI found the root cause and fix for the `typeof(foo) == Foo # false` discrepancy in interpreter. ## AI Summary: ### Root Cause The issue stemmed...

I have no idea. Maybe the first approach is the correct fix: ```diff diff --git a/src/compiler/crystal/interpreter/compiler.cr b/src/compiler/crystal/interpreter/compiler.cr index bba9d5093..da3b875a8 100644 --- a/src/compiler/crystal/interpreter/compiler.cr +++ b/src/compiler/crystal/interpreter/compiler.cr @@ -591,6 +591,17 @@ class Crystal::Repl::Compiler...

Alternative fix is not robust. It still fails for the non-reduced code. The first fix works for both reduced and non-reduced code.

Gemini AI analysis of root cause and fix: ### Root Cause The interpreter's compile_call_arg method in compiler.cr was unconditionally calling downcast when casting an argument type to the target definition's...

If we replace `foo(arg : Int32)` with `foo(arg : String)`, it gives a similar but different error: Error: BUG: missing downcast_distinct from Int32 to (Int32 | String) (Crystal::IntegerType to Crystal::MixedUnionType)...

Below is the fix by Gemini AI, and it works: Just a suggestion. ``` I modified the normalization of chained comparisons to use nested if expressions instead of && (And)...

@kostya Use gemini with antigravity, open the local git repo of crystal lang, add the buggy file to context then ask gemini to fix it.