Upgrade to Scala 3.8.0 and refactor for improved null safety#79
Open
halotukozak wants to merge 21 commits intomasterfrom
Open
Upgrade to Scala 3.8.0 and refactor for improved null safety#79halotukozak wants to merge 21 commits intomasterfrom
halotukozak wants to merge 21 commits intomasterfrom
Conversation
…union types, and updating nullability annotations
…xtension`, removing `implicitConversions`, and adopting modern patterns
…otations, add `@tailrec` annotations where applicable
…t.conf` for unused keywords
…and nullability annotations
…ean up completion and documentation generation logic
…add inline extensions
# Conflicts: # .github/workflows/ci.yml # build.sbt # test/org/jetbrains/plugins/hocon/usages/HoconFindUsagesTest.scala
# Conflicts: # .github/workflows/ci.yml # build.sbt # src/org/jetbrains/plugins/hocon/package.scala
…3 enums and types, adopt chaining syntax, and clean up imports
…iterateNonNull` extension method for improved null safety
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request upgrades the project from Scala 2.13.18 to Scala 3.8.0-RC5, introducing significant modernization and null-safety improvements. The changes include converting sealed traits/classes to enums, replacing case classes with type aliases, adopting union types for null-safety, modernizing implicit syntax to given/extensions, and replacing deprecated patterns with Scala 3 alternatives.
Key changes:
- Upgrade to Scala 3.8.0-RC5 with enhanced compiler options for null-safety and strict checking
- Introduction of
Iterator.iterateNonNullto replace theIterator.iterate(...).takeWhile(_ != null)pattern - Conversion of several sealed traits and case classes to Scala 3 enums and type aliases for improved type safety
Reviewed changes
Copilot reviewed 41 out of 43 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| build.sbt | Updated Scala version to 3.8.0-RC5 and added extensive compiler options for null-safety |
| .scalafmt.conf | Changed dialect from scala213source3 to scala3 and removed infix operator exclusions |
| .github/workflows/ci.yml | Updated CI workflow to use Scala 3.8.0-RC5 |
| test files | Updated type bounds, removed unused annotations, added explicit return types |
| src/.../HoconTestUtils.scala | Removed @nowarn annotation and added explicit return type |
| src/.../HoconSingleModuleTest.scala | Added explicit return types and imports |
| src/.../HoconMultiModuleTest.scala | Introduced `T |
| src/.../HoconActionTest.scala | Added @unused annotation for unused parameter |
| src/.../HoconProjectSettingsConfigurable.scala | Applied `T |
| src/.../ResolutionCtx.scala | Converted case classes to type aliases, sealed traits to enums, and Option to `T |
| src/.../IncludedFileReferenceSet.scala | Converted case class to type alias and changed wildcard types |
| src/.../HoconQualifiedNameProvider.scala | Added union types for null return values |
| src/.../HoconPropertiesReferenceProvider.scala | Updated return types with union types |
| src/.../HoconIncludeResolutionInspection.scala | Converted abstract class hierarchy to enum with cases |
| src/.../HKeyReference.scala | Updated return types with union types |
| src/.../HoconPsiElementFactory.scala | Updated return types with union types and replaced Iterator patterns |
| src/.../HoconPsiElement.scala | Extensive changes: updated type bounds, replaced Iterator.iterate patterns, updated return types |
| src/.../HoconErrorHighlightingAnnotator.scala | Added union type for parameter |
| src/.../HoconElementType.scala | Converted object with vals to enum with cases |
| src/.../package.scala | Added Iterator.iterateNonNull extension, updated extensions to use Scala 3 syntax, removed imports |
| src/.../navigation files | Converted classes to enums and updated type parameters |
| src/.../misc files | Added explicit return types and updated method signatures |
| src/.../manipulators | Added null checks and updated return types |
| src/.../lexer files | Converted token types to enums and updated State to opaque type |
| src/.../formatting files | Updated type annotations with union types |
| src/.../editor files | Added union types for null returns |
| resources/META-INF/plugin.xml | Updated class paths for enum-based inspection classes |
Files not reviewed (1)
- .idea/codeStyles/codeStyleConfig.xml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…proved type safety
… `HoconGotoPrevNextAction` to use case class constructors
# Conflicts: # build.sbt
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 of Changes
Iterator.takeWhile(_ != null)with safer Scala 3 enhancements, e.g.,Iterator.iterateNonNull.implicitwithgivenandextensionfor uniformity._with?in type usages.T | Nullfor robust null-safety.@nowarn) and unnecessary imports, tidied up.scalafmt.conf, and reduced clutter inpackage.scala.