From e89a66cefb21dd83245748859c3869ab09c06f94 Mon Sep 17 00:00:00 2001 From: Kacper Korban Date: Mon, 25 Nov 2024 16:38:36 +0100 Subject: [PATCH] Make context bounds for poly functions a standard feature (#22019) closes #22017 --- compiler/src/dotty/tools/dotc/parsing/Parsers.scala | 2 +- tests/pos/contextbounds-for-poly-functions.scala | 3 --- tests/run/contextbounds-for-poly-functions.scala | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 2e441553689c..ca8ebaf79b09 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -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) } diff --git a/tests/pos/contextbounds-for-poly-functions.scala b/tests/pos/contextbounds-for-poly-functions.scala index 13411a3ad769..49975cf8591d 100644 --- a/tests/pos/contextbounds-for-poly-functions.scala +++ b/tests/pos/contextbounds-for-poly-functions.scala @@ -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 diff --git a/tests/run/contextbounds-for-poly-functions.scala b/tests/run/contextbounds-for-poly-functions.scala index dcc974fce198..72eed8939fcf 100644 --- a/tests/run/contextbounds-for-poly-functions.scala +++ b/tests/run/contextbounds-for-poly-functions.scala @@ -1,6 +1,3 @@ -import scala.language.experimental.modularity -import scala.language.future - trait Show[X]: def show(x: X): String