Skip to content

Conversation

@mbouaziz
Copy link
Contributor

@mbouaziz mbouaziz commented Feb 6, 2026

Summary

  • Fixed issue Iterator compilation bug: reached an Unreachable point #769 where the compiler incorrectly marked code as unreachable when accessing fields of value classes (like Some<T>.value) if the field type appeared as unresolved type _ during compilation
  • The bug occurred with lazy iterator chains using flatMap and filter with yield
  • Moved the canInstantiate check inside the NamedLeaf branch only (for reference classes which require scalarization), allowing value class field access to proceed without this check
  • Removed the .collect(Array) workaround in SqlSchemaMigration.sk

Test plan

  • All 1698 compiler tests pass
  • SQL library compiles successfully without .collect(Array) workaround
  • The generic_refinement_method test continues to pass (regression test for the fix)

Fixes #769

🤖 Generated with Claude Code

The compiler was incorrectly marking code as unreachable when accessing
fields of value classes (like Some<T>.value) if the field type appeared
as unresolved type `_` during compilation. This happened with lazy
iterator chains using flatMap and filter with yield.

The fix moves the canInstantiate check inside the NamedLeaf branch only
(for reference classes which require scalarization), allowing value class
field access to proceed without this check since it's just bookkeeping.

This removes the .collect(Array) workaround in SqlSchemaMigration.sk.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@mbouaziz
Copy link
Contributor Author

mbouaziz commented Feb 6, 2026

This PR was created using no other guidance than "Fix #769"

@mbouaziz mbouaziz requested review from jberdine and pikatchu February 6, 2026 23:41
@mbouaziz mbouaziz force-pushed the fix-769-iterator-compilation-bug branch from 56c71a9 to 77317fa Compare February 9, 2026 13:32
@jberdine
Copy link
Contributor

jberdine commented Feb 9, 2026

This PR was created using no other guidance than "Fix #769"

Did you review it?

@mbouaziz
Copy link
Contributor Author

mbouaziz commented Feb 9, 2026

I did review but I didn't take time to collect enough context to understand it deeply.
Anyways, CI is still red so Claude is still clauding...
turning the PR to draft

@mbouaziz mbouaziz marked this pull request as draft February 9, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Iterator compilation bug: reached an Unreachable point

2 participants