Skip to content

Add Fallback[T] for AsRaw/AsReal/AsRawReal/RpcMetadataCompanion (D17) - #4

Closed
halotukozak wants to merge 3 commits into
fix-wsafe-init-hangfrom
fallback-implicit-priority
Closed

Add Fallback[T] for AsRaw/AsReal/AsRawReal/RpcMetadataCompanion (D17)#4
halotukozak wants to merge 3 commits into
fix-wsafe-init-hangfrom
fallback-implicit-priority

Conversation

@halotukozak

Copy link
Copy Markdown
Collaborator

Summary

  • Adds mrpc.Fallback[T], mirroring commons Fallback[T]: wraps a value to lower its implicit priority below normal givens.
  • Wires a fromFallback given at the bottom of the priority chain for AsRaw, AsReal, AsRawReal (below the existing fromSeparate), and RpcMetadataCompanion.
  • A Fallback-wrapped instance resolves via implicit search only when nothing else does; a normal given in scope still wins, with no ambiguity error.

Part of the D9-D17 gap list from #3. This branch was cut from master before #3 merged, so it doesn't yet touch DIVERGENCES.md's D17 entry — that'll get a small follow-up update marking Fallback[T] as implemented once #3 lands.

Test plan

  • CI green
  • test/mrpc/conv/FallbackSuite.scala — both directions (fallback resolves alone; normal given wins over fallback) for AsRaw/AsReal/AsRawReal
  • test/mrpc/meta/MetadataFallbackSuite.scala — same for RpcMetadataCompanion
  • No regression in existing mrpc.conv.* / mrpc.meta.* suites

🤖 Generated with Claude Code

Mirrors commons Fallback[T]: wraps a value to lower its implicit priority
below normal givens, via a fromFallback given at the bottom of each
typeclass's priority chain. A Fallback-wrapped instance resolves only when
nothing else does; a normal given always wins, no ambiguity.

DIVERGENCES.md's D17 entry will be updated once the D9-D17 doc PR (#3)
merges, since this branch predates it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@halotukozak
halotukozak changed the base branch from master to fix-project-scala-fmt August 8, 2026 14:24
Removes the stray blank line in project.scala (fails scala-cli 1.16's
directive formatter) and reformats FallbackSuite.scala, so the
"Check formatting" CI step can pass on this branch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Same root cause as fix-wsafe-init-hang: the compiler thread gets stuck
for 10+ minutes inside dotty's init-safety checker on this codebase's
inline-derivation-heavy code. See that PR for the full thread-dump
writeup.

Note: this branch still fails to compile independently of this fix
("Not found: type Fallback" in AsRaw.scala/AsReal.scala) -- looks like
the Fallback[T] type this PR is meant to add was never committed here.
Not touched, since that's this branch's own in-progress feature work.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@halotukozak
halotukozak force-pushed the fix-project-scala-fmt branch from d41b9ca to 8aa52bc Compare August 9, 2026 09:05
@halotukozak
halotukozak changed the base branch from fix-project-scala-fmt to fix-wsafe-init-hang August 10, 2026 06:17
@halotukozak

Copy link
Copy Markdown
Collaborator Author

Superseded by #21 — same reason as #3/#20. Same content, rebased onto #16.

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.

1 participant