You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -301,6 +301,32 @@ When implementing new code:
301
301
**Cause**: sbt-ossuminc 1.0.0 API change
302
302
**Fix**: Use `With.ScalaJS` instead
303
303
304
+
### Error: "No given instance of PlatformContext for default parameter"
305
+
**Cause**: Scala 3.7.4 limitation — default parameter values in a case
306
+
class's first parameter list cannot resolve `given` instances from a
307
+
subsequent `using` clause in the generated companion `apply` method.
308
+
**Fix**: Remove the default value. May be fixed in 3.9.x LTS.
309
+
**Example**:
310
+
```scala
311
+
// This fails in 3.7.4:
312
+
caseclassFoo(x: Bar=Bar())(usingPlatformContext)
313
+
// Fix: remove default (or provide explicit given)
314
+
caseclassFoo(x: Bar)(usingPlatformContext)
315
+
```
316
+
317
+
### Error: "parameters with defaults must be at the end" (Scala.js)
318
+
**Cause**: `@JSExportTopLevel` on a case class with `(using
319
+
PlatformContext)` in a second parameter list. The JS export sees the
320
+
context parameter as a non-default parameter after defaulted params.
321
+
**Fix**: Remove `@JSExportTopLevel` from internal data structures that
322
+
don't need to be constructed from JS code.
323
+
324
+
### System.lineSeparator() returns null in Scala.js
325
+
**Cause**: `System.lineSeparator()` returns `\0` in Scala.js
326
+
**Fix**: Use `PlatformContext.newline` instead. Never use
327
+
`System.lineSeparator()` in shared code. The `FileBuilder` trait
328
+
and its entire hierarchy use `(using PlatformContext)` for this.
329
+
304
330
## File Organization
305
331
306
332
### Creating New Modules
@@ -622,3 +648,7 @@ Then add to root aggregation: `.aggregate(..., mymodule, mymoduleJS, mymoduleNat
622
648
14.**BAST location comparisons use offsets** - Compare offset/endOffset, not line/col
623
649
15.**Scala version changes require workflow updates** - Update `scala-X.Y.Z` paths in workflows
624
650
16.**All RIDDL documentation goes to ossum.tech** - Don't add docs to this repo's `doc/` directory
651
+
17.**Never use System.lineSeparator() in shared code** - Use `PlatformContext.newline` instead; returns `\0` in Scala.js
652
+
18.**FileBuilder requires PlatformContext** - `trait FileBuilder(using PlatformContext)` — all subclasses must propagate the using clause
653
+
19.**Scala 3.7.4 default param limitation** - Case class defaults can't resolve givens from a subsequent using clause in generated apply; remove defaults or provide explicit givens
654
+
20.**@JSExportTopLevel incompatible with using clauses** - Don't use on case classes that have `(using PlatformContext)` in a second parameter list
0 commit comments