[Scala 3] restore positioned.here + SourceInfo.here#865
Open
halotukozak wants to merge 5 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR advances the Scala 3 port by restoring working Scala 3 implementations of annotation.positioned.here and misc.SourceInfo.here (via inline def + scala.quoted), updating related tests, and adjusting build/CI/configuration for Scala 3—while also removing the deprecated spring module and stubbing/commenting out large macro- and derivation-dependent areas that are not yet ported.
Changes:
- Implement Scala 3 quoted-macro versions of
positioned.hereandSourceInfo.here, and (re)enable/update their tests. - Move the build/CI/scalafmt baseline to Scala 3, simplify CI build steps, and adjust various Scala 3 syntax/typing constraints (e.g., wildcards, givens).
- Remove the deprecated
springmodule and delete/disable macro-heavy modules/tests pending Scala 3 replacements (many APIs temporarily stubbed with???).
Reviewed changes
Copilot reviewed 141 out of 141 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| spring/src/test/scala/com/avsystem/commons/spring/XmlPlayground.scala | Removed (spring module cleanup). |
| spring/src/test/scala/com/avsystem/commons/spring/Playground.scala | Removed (spring module cleanup). |
| spring/src/test/scala/com/avsystem/commons/spring/HoconBeanDefinitionReaderTest.scala | Removed (spring module cleanup). |
| spring/src/test/resources/testBean.conf | Removed (spring module cleanup). |
| spring/src/test/resources/conditionalsNested.conf | Removed (spring module cleanup). |
| spring/src/test/resources/conditionalsEnabled.conf | Removed (spring module cleanup). |
| spring/src/test/resources/conditionalsDisabled.conf | Removed (spring module cleanup). |
| spring/src/test/resources/conditionalInclude.conf | Removed (spring module cleanup). |
| spring/src/test/resources/beans.xml | Removed (spring module cleanup). |
| spring/src/test/resources/beans.conf | Removed (spring module cleanup). |
| spring/src/test/resources/bean2.conf | Removed (spring module cleanup). |
| spring/src/test/resources/bean1.conf | Removed (spring module cleanup). |
| spring/src/main/scala/com/avsystem/commons/spring/ScalaDefaultValuesInjector.scala | Removed (spring module cleanup). |
| spring/src/main/scala/com/avsystem/commons/spring/package.scala | Removed (spring module cleanup). |
| spring/src/main/scala/com/avsystem/commons/spring/HoconType.scala | Removed (spring module cleanup). |
| spring/src/main/scala/com/avsystem/commons/spring/HoconBeanDefinitionReader.scala | Removed (spring module cleanup). |
| spring/src/main/scala/com/avsystem/commons/spring/AttrNames.scala | Removed (spring module cleanup). |
| project/Commons.scala | Switch build baseline to Scala 3, drop/disable several modules, adjust GitHub Actions generation, add dependency version constants. |
| mongo/jvm/src/test/scala/com/avsystem/commons/mongo/typed/TypedMongoCollectionTest.scala | Commented out pending Scala 3 port. |
| mongo/jvm/src/test/scala/com/avsystem/commons/mongo/typed/testEntities.scala | Commented out pending Scala 3 port. |
| mongo/jvm/src/test/scala/com/avsystem/commons/mongo/typed/MongoUpdateTest.scala | Commented out pending Scala 3 port. |
| mongo/jvm/src/test/scala/com/avsystem/commons/mongo/typed/MongoRefTest.scala | Commented out pending Scala 3 port. |
| mongo/jvm/src/test/scala/com/avsystem/commons/mongo/typed/MongoProjectionTest.scala | Commented out pending Scala 3 port. |
| mongo/jvm/src/test/scala/com/avsystem/commons/mongo/typed/MongoOrderTest.scala | Commented out pending Scala 3 port. |
| mongo/jvm/src/test/scala/com/avsystem/commons/mongo/typed/MongoIndexTest.scala | Commented out pending Scala 3 port. |
| mongo/jvm/src/test/scala/com/avsystem/commons/mongo/typed/MongoFilterTest.scala | Commented out pending Scala 3 port. |
| mongo/jvm/src/test/scala/com/avsystem/commons/mongo/BsonInputOutputTest.scala | Commented out pending Scala 3 port. |
| mongo/jvm/src/main/scala/com/avsystem/commons/mongo/typed/TypedMongoUtils.scala | Stubbed Scala 2 macro-based helper (optionalizeFirstArg). |
| mongo/jvm/src/main/scala/com/avsystem/commons/mongo/typed/TypedMongoCollection.scala | Scala 3 typing workaround for ID type alias. |
| mongo/jvm/src/main/scala/com/avsystem/commons/mongo/typed/MongoRef.scala | Scala 3 using syntax + TypedMap key casting workaround. |
| mongo/jvm/src/main/scala/com/avsystem/commons/mongo/typed/MongoPolyDataCompanion.scala | Scala 3 wildcard/type-arg workaround. |
| mongo/jvm/src/main/scala/com/avsystem/commons/mongo/typed/MongoFormat.scala | Scala 3 wildcard/type-arg workarounds + using syntax adjustments. |
| mongo/jvm/src/main/scala/com/avsystem/commons/mongo/typed/MongoEntityCompanion.scala | Scala 3 typing workaround for ID type alias. |
| mongo/jvm/src/main/scala/com/avsystem/commons/mongo/typed/DataTypeDsl.scala | Stubbed Scala 2 macro-based DSL entrypoints. |
| mongo/jvm/src/main/scala/com/avsystem/commons/mongo/core/ops/BsonRefKeyValueHandling.scala | Scala 3 using syntax adjustments. |
| mongo/jvm/src/main/scala/com/avsystem/commons/mongo/BsonRef.scala | Stubbed Scala 2 macro-based ref creation. |
| macros/src/main/scala/com/avsystem/commons/macros/UniversalMacros.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/TypeClassDerivation.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/TestMacros.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/serialization/MongoMacros.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/serialization/GenRefMacros.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/serialization/GenKeyCodecMacros.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/serialization/CodecMacroCommons.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/serialization/BsonRefMacros.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/rpc/RpcSymbols.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/rpc/RpcMetadatas.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/rpc/RpcMacros.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/rpc/RPCFrameworkMacros.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/RecursiveImplicitMarker.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/misc/SealedMacros.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/misc/SamMacros.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/misc/Res.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/misc/LazyLoggingMacros.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/misc/DelegationMacros.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/misc/BidirectionalMacro.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/meta/MacroMetadatas.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/di/ComponentMacros.scala | Removed (Scala 2 macro code cleanup). |
| macros/src/main/scala/com/avsystem/commons/macros/CompatMacroCommons.scala | Removed (Scala 2 macro code cleanup). |
| hocon/src/test/scala/com/avsystem/commons/hocon/HoconInputTest.scala | Commented out pending Scala 3 port. |
| hocon/src/test/scala/com/avsystem/commons/hocon/HoconGenCodecRoundtripTest.scala | Commented out pending Scala 3 port. |
| hocon/src/main/scala/com/avsystem/commons/hocon/HTokenType.scala | Make values lazy for Scala 3 override constraints. |
| core/src/test/scala/com/avsystem/commons/testutil/CompilationErrorAssertions.scala | Commented out pending Scala 3 macro test support. |
| core/src/test/scala/com/avsystem/commons/serialization/StreamInputOutputTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/serialization/StreamGenCodecTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/serialization/SimpleGenCodecTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/serialization/NotUsedTransientDefault.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/serialization/json/JsonStringInputOutputTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/serialization/json/JsonGenCodecRoundtripTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/serialization/IgnoreTransientDefaultMarkerTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/serialization/GenRefTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/serialization/GenCodecRoundtripTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/serialization/CodecTestData.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/serialization/cbor/HFloatTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/serialization/cbor/CborInputOutputTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/rpc/Tag.scala | Lazy values + Scala 3 wildcard adjustment. |
| core/src/test/scala/com/avsystem/commons/misc/SourceInfoTest.scala | Reactivated/updated expectations for Scala 3 position semantics. |
| core/src/test/scala/com/avsystem/commons/misc/SealedEnumTest.scala | Make values lazy for Scala 3 override constraints. |
| core/src/test/scala/com/avsystem/commons/misc/NamedEnumTest.scala | Make values lazy for Scala 3 override constraints. |
| core/src/test/scala/com/avsystem/commons/misc/MacroInstancesTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/misc/ImplicitNotFoundTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/macros/TypeStringTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/macros/TreeForTypeTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/macros/KnownSubtypesTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/macros/JavaClassNameTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/macros/ApplyUnapplyTest.scala | Commented out pending Scala 3 port. |
| core/src/test/scala/com/avsystem/commons/annotation/PositionedTest.scala | New test validating positioned.here yields distinct call-site offsets. |
| core/src/main/scala/com/avsystem/commons/SharedExtensions.scala | Replace Scala 2 macro debug helpers with Scala 3 stubs. |
| core/src/main/scala/com/avsystem/commons/serialization/whenAbsent.scala | Replace Scala 2 macro helper with stub. |
| core/src/main/scala/com/avsystem/commons/serialization/TupleGenCodecs.scala | Replace Scala 2 macro tuple codec builder with stub. |
| core/src/main/scala/com/avsystem/commons/serialization/macroCodecs.scala | Replace Scala 2 macro materializers with stubs. |
| core/src/main/scala/com/avsystem/commons/serialization/HasGenCodec.scala | Scala 3 wildcard/type-arg workaround for HKTs. |
| core/src/main/scala/com/avsystem/commons/serialization/GenRef.scala | Replace Scala 2 macro ref generation with stubs. |
| core/src/main/scala/com/avsystem/commons/serialization/GenObjectCodec.scala | Replace Scala 2 macro materializers with stubs. |
| core/src/main/scala/com/avsystem/commons/serialization/GenKeyCodec.scala | Replace Scala 2 macro materializers with stubs; small lambda tweak. |
| core/src/main/scala/com/avsystem/commons/serialization/GenCodec.scala | Replace Scala 2 macro materializers with stubs; adjust some Scala 3 using calls. |
| core/src/main/scala/com/avsystem/commons/serialization/cbor/definitions.scala | Add explicit unapply for Scala 3 AnyVal wrapper behavior. |
| core/src/main/scala/com/avsystem/commons/serialization/cbor/CborAdtMetadata.scala | Scala 3 using syntax adjustments for codec usage. |
| core/src/main/scala/com/avsystem/commons/rpc/RpcUtils.scala | Replace Scala 2 macro compilationError with stub. |
| core/src/main/scala/com/avsystem/commons/rpc/RpcMetadataCompanion.scala | Replace Scala 2 macro materializers with stubs. |
| core/src/main/scala/com/avsystem/commons/rpc/RPCFramework.scala | Replace Scala 2 macro materializers with stubs. |
| core/src/main/scala/com/avsystem/commons/rpc/RawRpcCompanion.scala | Replace Scala 2 macro materializers with stubs. |
| core/src/main/scala/com/avsystem/commons/rpc/AsRawReal.scala | Replace Scala 2 macro materializers with stubs. |
| core/src/main/scala/com/avsystem/commons/misc/ValueEnum.scala | Replace Scala 2 macro helper with stub. |
| core/src/main/scala/com/avsystem/commons/misc/TypeString.scala | Replace Scala 2 macro materializers with stubs. |
| core/src/main/scala/com/avsystem/commons/misc/TypedMap.scala | Scala 3 wildcard workaround via K[Any] + casts in core typed map API. |
| core/src/main/scala/com/avsystem/commons/misc/Timestamp.scala | Scala 3 AnyVal inheritance workaround (drop Comparable). |
| core/src/main/scala/com/avsystem/commons/misc/SourceInfo.scala | Implement Scala 3 quoted macro for SourceInfo.here. |
| core/src/main/scala/com/avsystem/commons/misc/SimpleClassName.scala | Replace Scala 2 macro materializer with stub. |
| core/src/main/scala/com/avsystem/commons/misc/SelfInstance.scala | Scala 3 wildcard workaround + replace macro materializer with stub. |
| core/src/main/scala/com/avsystem/commons/misc/SealedUtils.scala | Replace Scala 2 macros with stubs; make values lazy. |
| core/src/main/scala/com/avsystem/commons/misc/SamCompanion.scala | Replace Scala 2 macro helpers with stubs. |
| core/src/main/scala/com/avsystem/commons/misc/Sam.scala | Replace Scala 2 macro helper with stub. |
| core/src/main/scala/com/avsystem/commons/misc/Implicits.scala | Replace Scala 2 macro-based infer helpers with stubs. |
| core/src/main/scala/com/avsystem/commons/misc/Delegation.scala | Replace Scala 2 macro helpers with stubs. |
| core/src/main/scala/com/avsystem/commons/misc/Bidirectional.scala | Replace Scala 2 macro helper with stub. |
| core/src/main/scala/com/avsystem/commons/misc/ApplierUnapplier.scala | Replace Scala 2 macro materializers with stubs. |
| core/src/main/scala/com/avsystem/commons/misc/AnnotationOf.scala | Replace Scala 2 macro materializers with stubs. |
| core/src/main/scala/com/avsystem/commons/meta/MetadataCompanion.scala | Replace Scala 2 macro lazyMetadata with stub. |
| core/src/main/scala/com/avsystem/commons/meta/metaAnnotations.scala | Replace Scala 2 macro helper with stub. |
| core/src/main/scala/com/avsystem/commons/meta/MacroInstances.scala | Replace Scala 2 macro materializer with stub. |
| core/src/main/scala/com/avsystem/commons/meta/AdtMetadataCompanion.scala | Replace Scala 2 macro materializers with stubs. |
| core/src/main/scala/com/avsystem/commons/di/Components.scala | Replace Scala 2 DI macros with stubs (large behavior change). |
| core/src/main/scala/com/avsystem/commons/collection/CloseableIterator.scala | Add @targetName to disambiguate overloaded apply in Scala 3. |
| core/src/main/scala/com/avsystem/commons/annotation/positioned.scala | Implement Scala 3 quoted macro for positioned.here. |
| core/src/main/scala/com/avsystem/commons/annotation/AnnotationAggregate.scala | Replace Scala 2 macro helper with stub. |
| core/jvm/src/test/scala/com/avsystem/commons/serialization/JGenCodecTest.scala | Commented out pending Scala 3 port. |
| core/jvm/src/test/scala/com/avsystem/commons/serialization/JCodecTestBase.scala | Commented out pending Scala 3 port. |
| core/jvm/src/test/scala/com/avsystem/commons/macros/TypeClassDerivationTest.scala | Commented out pending Scala 3 port. |
| core/jvm/src/test/scala/com/avsystem/commons/di/MyApp.scala | Commented out pending Scala 3 port. |
| core/jvm/src/test/scala/com/avsystem/commons/di/ComponentsTest.scala | Commented out pending Scala 3 port. |
| core/jvm/src/test/scala/com/avsystem/commons/di/ComponentsExample.scala | Commented out pending Scala 3 port. |
| core/jvm/src/test/scala/com/avsystem/commons/di/ComponentComposition.scala | Commented out pending Scala 3 port. |
| .scalafmt.conf | Switch scalafmt dialect to Scala 3. |
| .github/workflows/ci.yml | Update CI matrix Scala version and build step (now compile-only). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…uotes
- positioned.here: Int = ${ hereImpl } using Position.ofMacroExpansion.start
- SourceInfo.here: SourceInfo via Position.ofMacroExpansion + Symbol.spliceOwner walk
- macro impls live inline next to public inline defs (no separate macros.* package)
- disable sbt-ci-release plugin to avoid JGit NoWorkTreeException in linked worktrees
- new PositionedTest asserts two adjacent positioned.here calls yield distinct positive offsets - update SourceInfoTest pattern values to match Scala 3 Position.ofMacroExpansion semantics (offset 205, column 17 — receiver start, not method name)
- drop backlog rows for positioned.scala:12 and SourceInfo.scala:28 - update Total tags count 155 -> 154 - document sbt-ci-release plugin disable (JGit worktree incompat)
c6884ab to
a79fb81
Compare
MajronMan
reviewed
Jun 2, 2026
… assertion - use Matchers for improved assertion readability - add test to verify `positioned.here` offset corresponds to the term's start offset
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
Restores
annotation.positioned.here: Intandmisc.SourceInfo.here: SourceInfofrom???stubs to working Scala 3inline def+scala.quotedimplementations.positioned.herereturnsPosition.ofMacroExpansion.start: Intof the call site.SourceInfo.herereturns a populatedSourceInfo(filePath, fileName, offset, line, column, lineContent, enclosingSymbols) viaPosition.ofMacroExpansion+Symbol.spliceOwnerowner-chain walk.inline def— no separatecommons.macros.*package.SourceInfo.apply()(implicit si: SourceInfo)preserved (minimum-diff for downstreamsummon[SourceInfo]andimplicitly[SourceInfo]).Tests
PositionedTest— asserts two adjacentpositioned.herecalls yield distinct positiveIntoffsets.SourceInfoTestreactivated — pattern-matches expectedSourceInfo(...)shape. Offset/column constants updated from 216/28 (Scala 2.13 macro semantics) to 205/17 (Scala 3Position.ofMacroExpansionpoints at receiver start, not method name).MIGRATION.md
positioned.scala:12,SourceInfo.scala:28.Total tags: 155 -> 154.sbt-ci-releaseplugin disabled in § 5 (transitively pullssbt-gitwhose JGit chokes on linked git worktrees withNoWorkTreeException). Restore effort: S — re-enable once releasing.Test plan
sbt commons-core/compileexit 0sbt 'commons-core/testOnly com.avsystem.commons.annotation.PositionedTest com.avsystem.commons.misc.SourceInfoTest'exit 0sbt scalafmtCheckAll scalafmtSbtCheckexit 0