Skip to content

Commit

Permalink
Make context bounds for poly functions a standard feature (#22019)
Browse files Browse the repository at this point in the history
closes #22017

[Cherry-picked e89a66c]
  • Loading branch information
KacperFKorban authored and WojciechMazur committed Nov 25, 2024
1 parent 236cb8a commit 88f4a93
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 7 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3492,7 +3492,7 @@ object Parsers {
val hkparams = typeParamClauseOpt(ParamOwner.Hk)
val bounds =
if paramOwner.acceptsCtxBounds then typeAndCtxBounds(name)
else if in.featureEnabled(Feature.modularity) && paramOwner == ParamOwner.Type then typeAndCtxBounds(name)
else if sourceVersion.isAtLeast(`3.6`) && paramOwner == ParamOwner.Type then typeAndCtxBounds(name)
else typeBounds()
TypeDef(name, lambdaAbstract(hkparams, bounds)).withMods(mods)
}
Expand Down
3 changes: 0 additions & 3 deletions tests/pos/contextbounds-for-poly-functions.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import scala.language.experimental.modularity
import scala.language.future

trait Ord[X]:
def compare(x: X, y: X): Int
type T
Expand Down
3 changes: 0 additions & 3 deletions tests/run/contextbounds-for-poly-functions.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import scala.language.experimental.modularity
import scala.language.future

trait Show[X]:
def show(x: X): String

Expand Down

0 comments on commit 88f4a93

Please sign in to comment.