Skip to content

Add using clause. fix compile error with Scala 3.8#4806

Merged
satorg merged 1 commit intotypelevel:mainfrom
xuwei-k:scala-3-8-using
Feb 9, 2026
Merged

Add using clause. fix compile error with Scala 3.8#4806
satorg merged 1 commit intotypelevel:mainfrom
xuwei-k:scala-3-8-using

Conversation

@xuwei-k
Copy link
Contributor

@xuwei-k xuwei-k commented Jan 7, 2026

Welcome to Scala 3.7.4 (21.0.9, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                                            
scala> scala.collection.immutable.SortedMap(1 -> 2)(implicitly[Ordering[Int]])
1 warning found
-- Warning: --------------------------------------------------------------------
1 |scala.collection.immutable.SortedMap(1 -> 2)(implicitly[Ordering[Int]])
  |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^
  |Implicit parameters should be provided with a `using` clause.
  |To disable the warning, please use the following option:
  |  "-Wconf:msg=Implicit parameters should be provided with a `using` clause:s"
val res0: scala.collection.immutable.SortedMap[Int, Int] = TreeMap(1 -> 2)
Welcome to Scala 3.8.0-RC5 (21.0.9, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                                            
scala> scala.collection.immutable.SortedMap(1 -> 2)(implicitly[Ordering[Int]])
-- [E007] Type Mismatch Error: -------------------------------------------------
1 |scala.collection.immutable.SortedMap(1 -> 2)(implicitly[Ordering[Int]])
  |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^
  |                                             Found:    Ordering[Int]
  |                                             Required: Int
  |
  | longer explanation available when compiling with `-explain`
1 error found
                                                                                                                                            
scala> scala.collection.immutable.SortedMap(1 -> 2)(using implicitly[Ordering[Int]])
val res0: scala.collection.immutable.SortedMap[Int, Int] = TreeMap(1 -> 2)

Copy link
Contributor

@satorg satorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, totally makes sense even without Scala 3.8 compatibility concern.
Thank you!

@satorg satorg merged commit 2e090df into typelevel:main Feb 9, 2026
29 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants