kubuszok/kindlings/hearth-cross-compilation

Claude Code and agent skill by kubuszok/kindlings

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Cross-compilation pitfalls for Scala 2.13 + 3 macros with Hearth. Path-dependent types, splice isolation, type constructor matching, reification failures, Array ClassTag, upcast constraints, phantom types, asInstanceOf semantics, IsMap ordering.

Install

npx vskill@latest install kubuszok/kindlings/hearth-cross-compilation

SKILL.md

Skill: Cross-Compilation Pitfalls

Live reference for things that bite when writing cross-compiled Kindlings macros. Each entry in pitfalls.md describes the failure mode, the platform(s) it affects, and the workaround.

For higher-level rules around extension loading and LambdaBuilder scope, see hearth-standard-extensions and hearth-lambda-builder.

Pitfall index

Splice and quote scoping
#PitfallSeverityPlatforms
1Sibling `Expr.splice` isolationCRITICALScala 3
2`Expr.quote { (x: T) => ... }` is supportedLOWBoth
3Path-dependent types in `Expr.quote`CRITICALScala 2
4Macro-internal types leaking into `Expr.quote`HIGHScala 2
5`Expr.upcast` only widensMEDIUMBoth
6`ValDefsCache` wrapping scopeHIGHBoth
Type system details
#PitfallSeverityPlatforms
7Macro methods need concrete typesMEDIUMBoth
8Phantom type-parameter inferenceHIGHBoth
9[Type.of[A] bootstrap cycle in extensions](pitfalls.md#9-typeof-a-bootstrap-cycle-in-extensions)CRITICALBoth
10`IsMap` before `IsCollection` orderingHIGHBoth
11[`Type.Ctor2.of[Function1].unapply` wrong](pitfalls.md#11-typector2offunction1unapply-wrong) (fixed in kubuszok/hearth#389)—Scala 3
12`primaryConstructor` strict type checkingHIGHBoth
13`Array` needs `ClassTag`MEDIUMBoth
Implicit summoning
#PitfallSeverityPlatforms
14`summonExprIgnoring` vs OOMCRITICALBoth
15Newtype aliases in `Expr.quote`HIGHScala 2
16Cross-quotes unused `Type` implicit warningsMEDIUMBoth
HKT (kind * -> *) derivation
#PitfallSeverityPlatforms
17HKT type constructor summoning across compilation boundaryHIGHBoth
18Erased approach for polymorphic type classesMEDIUMScala 2
19`IsValueType` intercepts single-element named tuplesHIGHScala 3
20`MacroExtension` ClassTag erasureMEDIUMBoth
Additional Scala 2 reification pitfalls
#PitfallSeverityPlatforms
21`.asInstanceOf` is NOT fully erased for outer typesHIGHJVM
22Scala 2 reification failure with refined typesHIGHScala 2
23Helper method pattern for path-dependent types in providersMEDIUMScala 2
24Newtype type aliases in `Expr.quote`HIGHScala 2
25Macro methods require concrete types at call siteMEDIUMBoth
26Sibling `Expr.splice` blocks have isolated `Quotes`CRITICALScala 3
27`ValDefsCache` wrapping scope for multi-function derivationHIGHBoth
28Path-dependent types from `IsMap`/`IsCollection`MEDIUMScala 3
29Discriminator-style enum decodingMEDIUMBoth
30Built-in type rule is mandatoryHIGHBoth
31`group()` is from `MacroSuite`LOWBoth
32`ProviderResult` is not `Option`MEDIUMBoth
33`primaryConstructor` type-checks field expressions strictlyHIGHBoth
34`parTraverse` and `ValDefsCache` state threadingHIGHBoth
Non-derivation macro modules (di / mock / optics)
#PitfallSeverityPlatforms
35[classOf[M] impossible for an abstract type param (use ClassTag[M].runtimeClass)](pitfalls.md#35-classofm-is-impossible-for-an-abstract-macro-type-parameter)HIGHBoth
36[Class shadowed by Hearth's cake Class[A] (use java.lang.Class)](pitfalls.md#36-class-is-shadowed-by-hearths-cake-classa-inside-macro-code)MEDIUMBoth
37`@compileTimeOnly` fires on S3 `extension` not S2 `implicit class`MEDIUMScala 2
38Marker DSLs need INVARIANT evidence to pin element typesHIGHScala 2
39Context-function values are eta-applied in testsMEDIUMScala 3
40Gate S3 DSL markers behind a phantom context function (peel with `betaReduce` + `Block` unwrap)MEDIUMScala 3
Resolved Hearth issues (for context only)
#IssueStatus
R1parTraverse and ValDefsCacheFixed in Hearth 0.2.0-268+
R2loadStandardExtensions repeated registrationFixed in Hearth 0.2.0-257
R3Cross-quotes Type.Ctor1 resolution in HKTFixed in Hearth 0.2.0-263+

Quick reference: most common pitfalls

The top pitfalls encountered in practice, by frequency:

  1. Path-dependent types in `Expr.quote` (#3) -- use helper methods with regular type params
  2. Sibling splice isolation (#1, #26) -- use def-caching, not LambdaBuilder
  3. `summonExprIgnoring` vs OOM (#14) -- always pass ignored implicits
  4. `IsMap` before `IsCollection` (#10) -- check map first in pattern match
  5. ~~`Type.Ctor2.of[Function1].unapply`~~ (#11) -- fixed in kubuszok/hearth#389: Scala 3 .of used to return

Nothing for the contravariant argument of a SUBTYPE (e.g. IntPredicate extends (Int => Boolean)). Plain .of is now correct on both platforms; do not wrap with fromUntyped.

  1. ~~`fromUntyped` for ALL SPI-boundary type matching~~ -- DISPROVEN on Hearth 0.4.3 (refined/iron

providers now use plain Type.Ctor2.of and all integration tests pass; Hearth-suite test shows SPI-loaded extensions behave like same-file code). Original claim, kept for history: any Type.Ctor1/Ctor2 created in one compilation unit and unapply'd in another (via StandardMacroExtension SPI) needs fromUntyped wrapping. Affects: iron/refined integrations, cats collection/map providers, cats-derivation contravariant/bifunctor. Pattern: val MyCtor = Type.Ctor2.fromUntyped[F](Type.Ctor2.of[F].asUntyped)

See pitfalls.md for detailed descriptions of all entries.

Related skills

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
62
Repository forks
6
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/kubuszok/kindlings/hearth-cross-compilation/badge)](https://verified-skill.com/skills/kubuszok/kindlings/hearth-cross-compilation)

Something wrong with this skill or its page? Tell us.