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 Dec 9, 2024
1 parent 73168ee commit f1ad9a9
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 @@ -3491,7 +3491,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 f1ad9a9

Please sign in to comment.