forked from scala/scala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove multi-parameter, vararg variant of + and -
Ref scala/scala-dev#496 Ref scala/scala3#4311 (comment) Using the `compileTimeError` annotation, this removes the multi-parameter, vararg variants of `+` and `-` operators from the collections, and instructs the users to migrate to `++` and `--` instead. This is part of an effort to remove the ambiguity between tuple literal and parameter list when in an infixed operator notation.
- Loading branch information
Showing
18 changed files
with
88 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
collection-removal.scala:4: error: use of method + in trait MapOps is unsupported: use ++ with an explicit collection argument instead | ||
val m1 = scala.collection.Map("foo" -> 1) + (("bar" -> 2), ("baz" -> 3)) | ||
^ | ||
collection-removal.scala:5: error: use of method - in trait Map is unsupported: use -- or removeAll on an immutable Map instead | ||
val m2 = scala.collection.Map("foo" -> 1) - ("foo", "bar", "baz") | ||
^ | ||
collection-removal.scala:7: error: use of method + in trait SortedMapOps is unsupported: use ++ with an explicit collection argument instead | ||
val sm1 = scala.collection.SortedMap("foo" -> 1) + (("bar" -> 2), ("baz" -> 3)) | ||
^ | ||
collection-removal.scala:9: error: use of method - in trait MapOps is unsupported: use -- with an explicit collection argument instead | ||
val im1 = scala.collection.immutable.Map("foo" -> 1) - ("foo", "bar", "baz") | ||
^ | ||
collection-removal.scala:11: error: use of method + in class LongMap is unsupported: use ++ with an explicit collection argument instead | ||
val lm1 = scala.collection.mutable.LongMap(1L -> 1) + ((2L -> 2), (3L -> 3)) | ||
^ | ||
collection-removal.scala:13: error: use of method - in trait SetOps is unsupported: use &- with an explicit collection argument instead | ||
val s1 = scala.collection.Set(1, 2) - (1, 2, 3) | ||
^ | ||
collection-removal.scala:14: error: use of method + in trait SetOps is unsupported: use ++ with an explicit collection argument instead | ||
val s2 = scala.collection.Set(1, 2) + (1, 2, 3) | ||
^ | ||
collection-removal.scala:16: error: use of method += in trait Growable is unsupported: use `++=` or addAll instead | ||
val lb1 = scala.collection.mutable.ListBuffer(1) += (1, 2, 3) | ||
^ | ||
8 errors found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// scalac: -deprecation -Xfatal-warnings | ||
|
||
object Test1 { | ||
val m1 = scala.collection.Map("foo" -> 1) + (("bar" -> 2), ("baz" -> 3)) | ||
val m2 = scala.collection.Map("foo" -> 1) - ("foo", "bar", "baz") | ||
|
||
val sm1 = scala.collection.SortedMap("foo" -> 1) + (("bar" -> 2), ("baz" -> 3)) | ||
|
||
val im1 = scala.collection.immutable.Map("foo" -> 1) - ("foo", "bar", "baz") | ||
|
||
val lm1 = scala.collection.mutable.LongMap(1L -> 1) + ((2L -> 2), (3L -> 3)) | ||
|
||
val s1 = scala.collection.Set(1, 2) - (1, 2, 3) | ||
val s2 = scala.collection.Set(1, 2) + (1, 2, 3) | ||
|
||
val lb1 = scala.collection.mutable.ListBuffer(1) += (1, 2, 3) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters