Scala 3.7.4 upgrade and module reorganization#719
Merged
Conversation
Document Scala version upgrade blocker: - Compiler infinite loop bug with intersection types - Parser lambda syntax changes completed - AST extension restructuring completed - Both 3.7.4 and 3.6.3 trigger hasClassSymbol recursion Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add grammar rules for selective import syntax: - import domain X from "file.bast" - import type T from "file.bast" as MyT - Support for kind, selector, and alias components Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
BASTLoader: - Handle selective imports that filter by kind and name - Support aliasing of imported definitions - Process imports in contexts as well as domains BASTReader/BASTWriter: - Read/write new BASTImport fields (kind, selector, alias) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
CommonParser: - Add importableKind parser for definition types - Add selectiveBastImport for "import kind X from file" syntax - Add fullBastImport for simple "import file" syntax - Combined bastImport parser handles both forms ParsingContext: - Update doBASTImport to accept kind, selector, and alias - Validate .bast extension Syntax variants supported: - import "path/to/file.bast" - import domain X from "file.bast" - import type T from "file.bast" as MyT Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Test input files: - rbbq.riddl: Updated domain example - bast-import.riddl: Test cases for selective imports Python validation: - riddl_grammar.lark: Lark grammar derived from EBNF - ebnf_validator.py: Validation script for testing RIDDL files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
WHY SCALA 3.7.4? Scala 3.7 changed how underscore syntax works with context-bound methods. The pattern `include[u, XxxContents](xxxDefinitions(_))` no longer works because Scala 3.7 tries to resolve `AST.apply` extension method first, interfering with fastparse's method resolution. CHANGES MADE: build.sbt: - Override scalaVersion to 3.7.4 in all 7 modules - TASTy is forward-compatible (3.7.4 output works with 3.3.7 consumers) AST.scala - Extension method restructuring: - Moved apply(n: Int) extension into Contents companion object - This prevents AST.apply from polluting the namespace - Separated merge extension (with CV & CV2 intersection type) to its own block - Other extension methods remain at top level for availability within AST Parser files - Explicit lambda syntax: - Changed all `methodName(_)` to `p => methodName(using p)` - This works correctly with Scala 3.7's new extension resolution rules - 14 parser files updated with this pattern JVMPlatformContext.scala: - Updated implicit Codec parameter to use explicit `using` keyword KNOWN ISSUE - COMPILER BUG: Both Scala 3.7.4 and 3.6.3 exhibit an infinite loop when compiling: - hasClassSymbol recursion in Types.scala:648 - computeAndOrType recursion in SymDenotations.scala:2312 The intersection type `Contents[CV & CV2]` in the merge method triggers this. Investigation needed to find a Scala version or workaround. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add commit hashes for both branches pushed to GitHub. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The compiler was entering an infinite loop due to duplicate Contents opaque type definitions - one in AST.scala object and one in Contents.scala at package level. Scala 3.7.4 has a known bug with opaque types inside objects, particularly with intersection types. Changes: - Removed Contents definition from AST.scala object (lines 107-229) - Kept only package-level Contents.scala with all extensions - Renamed Contents.map extension to mapValue to avoid ambiguity - Changed merge extension to return Contents[RiddlValue] instead of CV & CV2 - Fixed BASTImport: renamed kind field to kindOpt, added kind method override - Updated all parser files to import Contents from package level - Fixed Root.empty to use def instead of val - Updated BASTWriter and BASTLoader to use bi.kindOpt Result: Language module compiles successfully with Scala 3.7.4 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Changes for Scala 3.7.4 compatibility:
1. Context function syntax in tests (3 files)
- Changed `tp.root` to `p => tp.root(using p)` for explicit context params
- TestParserTest.scala, TestParsingRules.scala, CommonParserTest.scala
2. Contents extension imports (32+ files)
- Added `import com.ossuminc.riddl.language.{Contents, *}` for extension methods
- Required because Contents opaque type extensions are at package level
3. Intersection type syntax (BASTWriterPass.scala)
- Changed `Branch[?] with WithMetaData` to `(Branch[?] & WithMetaData)`
4. Unreachable pattern matches (ReferenceMapTest.scala)
- Removed `case x => fail(...)` after exhaustive Option matches
All 714 JVM tests pass.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Required for Scala 3.7.4 compatibility - Contents opaque type extensions are at package level and need explicit wildcard import. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Documentation has been moved to ossum.tech. The docsite module was causing a Scala 3.7.4 compiler bug (ClassCastException in type system). The redirect-site in doc/ remains for URL redirects from riddl.tech. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
|
The test was using Scala 3.4.2 but riddl-commands is now built with Scala 3.7.4, causing TASTy incompatibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
scala-steward
pushed a commit
to scala-steward/riddl-1
that referenced
this pull request
Feb 20, 2026
Scala 3.7.4 upgrade and module reorganization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Changes
Test plan
🤖 Generated with Claude Code