Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop warning on higher-kinded usage without -language:higherKinds #8348

Merged
merged 1 commit into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/compiler/scala/tools/nsc/typechecker/Typers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2436,9 +2436,6 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
case _ => ()
}

if (tdef.symbol.isDeferred && tdef.symbol.info.isHigherKinded)
checkFeature(tdef.pos, currentRun.runDefinitions.HigherKindsFeature)

treeCopy.TypeDef(tdef, typedMods, tdef.name, tparams1, rhs1) setType NoType
}

Expand Down
1 change: 1 addition & 0 deletions src/library/scala/language.scala
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ object language {
*
* @group production
*/
@deprecated("higherKinds no longer needs to be imported explicitly", "2.13.1")
implicit lazy val higherKinds: higherKinds = languageFeature.higherKinds

/** Where this feature is enabled, existential types that cannot be expressed as wildcard
Expand Down
1 change: 1 addition & 0 deletions src/library/scala/languageFeature.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ object languageFeature {
sealed trait implicitConversions
object implicitConversions extends implicitConversions

@deprecated("scala.language.higherKinds no longer needs to be imported explicitly", "2.13.1")
@meta.languageFeature("higher-kinded type", enableRequired = false)
sealed trait higherKinds
object higherKinds extends higherKinds
Expand Down
3 changes: 3 additions & 0 deletions src/reflect/scala/reflect/internal/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,10 @@ trait Definitions extends api.StandardDefinitions {
lazy val PostfixOpsFeature = getLanguageFeature("postfixOps")
lazy val ReflectiveCallsFeature = getLanguageFeature("reflectiveCalls")
lazy val ImplicitConversionsFeature = getLanguageFeature("implicitConversions")

@deprecated("scala.language.higherKinds no longer needs to be imported explicitly", "2.13.1")
lazy val HigherKindsFeature = getLanguageFeature("higherKinds")

lazy val ExistentialsFeature = getLanguageFeature("existentials")

lazy val ApiUniverseReify = ApiUniverseClass.map(sym => getDeclIfDefined(sym, nme.reify))
Expand Down
3 changes: 1 addition & 2 deletions test/files/neg/t2462b.check
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ t2462b.scala:21: warning: Invalid implicitNotFound message for value i:
The type parameters XX, ZZ, Nix referenced in the message of the @implicitNotFound annotation are not in scope.
def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ???
^
warning: there were two feature warnings; re-run with -feature for details
error: No warnings can be incurred under -Werror.
5 warnings found
four warnings found
one error found
11 changes: 0 additions & 11 deletions test/files/neg/t8736-c.check

This file was deleted.

7 changes: 0 additions & 7 deletions test/files/neg/t8736-c.scala

This file was deleted.

1 change: 1 addition & 0 deletions test/files/pos/higherKinds.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-feature -Xfatal-warnings
4 changes: 4 additions & 0 deletions test/files/pos/higherKinds.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
object Test {
type F[A] <: List[A]
def foo[G[X] <: List[X]](x: F[Int]): F[Int] = x
}
1 change: 0 additions & 1 deletion test/files/pos/t10623.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

// scalac: -Xfatal-warnings -Xlint:unused
//
import language.higherKinds

object `package` {
def refl[A]: A Is A = ???
Expand Down
1 change: 0 additions & 1 deletion test/files/run/inferred-type-constructors-hou.check
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
warning: there were two feature warnings; re-run with -feature for details
p.Iterable[Int]
p.Set[Int]
p.Seq[Int]
Expand Down
1 change: 0 additions & 1 deletion test/files/run/inferred-type-constructors.check
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
warning: there were two feature warnings; re-run with -feature for details
p.Iterable[Int]
p.Set[Int]
p.Seq[Int]
Expand Down
1 change: 0 additions & 1 deletion test/files/run/t7319.check
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ warning: there was one feature warning; for details, enable `:setting -feature'
ma1: [A](a: A)M[A]

scala> def convert[F[X <: F[X]]](builder: F[_ <: F[_]]) = 0
warning: there was one feature warning; for details, enable `:setting -feature' or `:replay -feature'
convert: [F[X <: F[X]]](builder: F[_ <: F[_]])Int

scala> convert(Some[Int](0))
Expand Down