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
Scala 3 Infix #2158
Merged
cheeseng
merged 53 commits into
scalatest:3.2.x-new
from
cheeseng:feature-scala-3-infix
Aug 22, 2022
Merged
Scala 3 Infix #2158
Changes from 39 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
d1f4278
First batch of matchers DSL classes with functions marked as infix fo…
cheeseng 00e0b7d
Enhanced FullyMatchWord.scala to include infix in DSL functions for S…
cheeseng a1665a4
Enhanced HaveWord.scala to include infix in DSL functions for Scala 3…
cheeseng df9f391
Enhanced IncludeWord.scala to include infix in DSL functions for Scal…
cheeseng d45c4a2
Enhanced LengthWord.scala to include infix in DSL functions for Scala…
cheeseng 364cdea
Enhanced MatcherWords.scala to include infix in DSL functions for Sca…
cheeseng 87f0e12
Enhanced NoExceptionWord.scala to include infix in DSL functions for …
cheeseng 3d9118c
Enhanced ResultOfAnTypeInvocation.scala to include infix in DSL funct…
cheeseng d91207f
Enhanced ResultOfATypeInvocation.scala to include infix in DSL functi…
cheeseng 8615636
Enhanced ResultOfBeThrownBy.scala to include infix in DSL functions f…
cheeseng 1a1e32f
Enhanced ResultOfBeWordForAnType.scala to include infix in DSL functi…
cheeseng 8381fde
Enhanced ResultOfBeWordForAType.scala to include infix in DSL functio…
cheeseng af03d29
Enhanced ResultOfBeWordForNoException.scala to include infix in DSL f…
cheeseng 39df6fa
Enhanced ResultOfContainWord.scala to include infix in DSL functions …
cheeseng a1a2adc
Enhanced ResultOfGreaterThanComparison.scala to include infix in DSL …
cheeseng b4d14aa
Enhanced ResultOfGreaterThanOrEqualToComparison.scala to include infi…
cheeseng 87f4ff7
Enhanced ResultOfLengthWordApplication.scala to include infix in DSL …
cheeseng e124a3a
Enhanced ResultOfLessThanComparison.scala to include infix in DSL fun…
cheeseng e16c23e
Enhanced ResultOfLessThanOrEqualToComparison.scala to include infix i…
cheeseng cfebf90
Enhanced ResultOfMessageWordApplication.scala to include infix in DSL…
cheeseng 67311a5
Enhanced ResultOfNotExist.scala to include infix in DSL functions for…
cheeseng 4f01909
Enhanced ResultOfSizeWordApplication.scala to include infix in DSL fu…
cheeseng adecc56
Enhanced ResultOfTheTypeInvocation.scala to include infix in DSL func…
cheeseng 34cfb4c
Enhanced SizeWord.scala to include infix in DSL functions for Scala 3…
cheeseng 22a9b21
Enhanced StartWithWord.scala to include infix in DSL functions for Sc…
cheeseng a142b6c
Work in progress enhancing Matchers.scala to include infix in DSL fun…
cheeseng b0fd774
Another batch of Work in progress enhancing Matchers.scala to include…
cheeseng 5dd8358
Fixed Scala 3 js and native build.
cheeseng 15088a3
Removed unnecessary if or check.
cheeseng 6ceddcb
Another batch of Work in progress enhancing Matchers.scala to include…
cheeseng f84f3eb
Another batch of Work in progress enhancing Matchers.scala to include…
cheeseng 958b4bf
Another batch of Work in progress enhancing Matchers.scala to include…
cheeseng cdc03ad
Another batch of Work in progress enhancing Matchers.scala to include…
cheeseng 5827de6
Another batch of Work in progress enhancing Matchers.scala to include…
cheeseng d0dbcbe
Another batch of Work in progress enhancing Matchers.scala to include…
cheeseng cebe03a
Another batch of Work in progress enhancing Matchers.scala to include…
cheeseng fa22822
Another batch of Work in progress enhancing Matchers.scala to include…
cheeseng af9e0bc
Another batch of Work in progress enhancing Matchers.scala to include…
cheeseng 52daf27
Completed enhancing Matchers.scala to include infix in DSL functions …
cheeseng 3f56b52
Removed infix for <, <=, > and >= functions in Matchers.scala.
cheeseng d54b7dd
Removed infix for >, >=, < and <= functions in BeWord.scala.
cheeseng c8dcf54
Removed infix for === function in BeWord.scala.
cheeseng a90c2b7
Removed infix modifier for apply functions in Matchers.scala.
cheeseng ebceea7
Removed infix modifier for apply functions in BeWord.scala.
cheeseng f5d5504
Removed infix modifier from apply functions in MatchPatternWord.scala…
cheeseng 9ca3603
Removed infix modifier for apply functions in ContainWord, EndWithWor…
cheeseng 0b07768
Removed infix modifier from apply functions in IncludeWord, LengthWor…
cheeseng 3bea02a
Removed infix modifier in for apply functions in ResultOfGreaterThanO…
cheeseng 806339b
Removed infix modifier for apply functions in ResultOfLessThanOrEqual…
cheeseng a8b03ca
Removed infix modifier for apply functions in SizeWord and StartWithW…
cheeseng 3c12779
Removed infix modifier for functions in Matchers.scala that is not us…
cheeseng 9707b89
Removed infix modifier for functions in MatcherWords.scala that is no…
cheeseng e6efb6f
Removed unnecessary infix modifiers in NotWord.scala.
cheeseng File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def <[T : Ordering](right: T): Matcher[T] = | ||
infix def <[T : Ordering](right: T): Matcher[T] = | ||
new Matcher[T] { | ||
def apply(left: T): MatchResult = { | ||
val ordering = implicitly[Ordering[T]] | ||
|
@@ -129,7 +129,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def >[T : Ordering](right: T): Matcher[T] = | ||
infix def >[T : Ordering](right: T): Matcher[T] = | ||
new Matcher[T] { | ||
def apply(left: T): MatchResult = { | ||
val ordering = implicitly[Ordering[T]] | ||
|
@@ -168,7 +168,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def <=[T : Ordering](right: T): Matcher[T] = | ||
infix def <=[T : Ordering](right: T): Matcher[T] = | ||
new Matcher[T] { | ||
def apply(left: T): MatchResult = { | ||
val ordering = implicitly[Ordering[T]] | ||
|
@@ -207,7 +207,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def >=[T : Ordering](right: T): Matcher[T] = | ||
infix def >=[T : Ordering](right: T): Matcher[T] = | ||
new Matcher[T] { | ||
def apply(left: T): MatchResult = { | ||
val ordering = implicitly[Ordering[T]] | ||
|
@@ -234,7 +234,7 @@ final class BeWord { | |
* </p> | ||
*/ | ||
@deprecated("The deprecation period for the be === syntax has expired. Please use should equal, should ===, shouldEqual, should be, or shouldBe instead.") | ||
def ===(right: Any)(implicit pos: source.Position): Matcher[Any] = { | ||
infix def ===(right: Any)(implicit pos: source.Position): Matcher[Any] = { | ||
throw new NotAllowedException(FailureMessages.beTripleEqualsNotAllowed, pos) | ||
} | ||
|
||
|
@@ -247,7 +247,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def a(right: Symbol)(implicit prettifier: Prettifier, pos: source.Position): Matcher[AnyRef] = | ||
infix def a(right: Symbol)(implicit prettifier: Prettifier, pos: source.Position): Matcher[AnyRef] = | ||
new Matcher[AnyRef] { | ||
def apply(left: AnyRef): MatchResult = matchSymbolToPredicateMethod(left, right, true, true, prettifier, pos) | ||
override def toString: String = "be a " + prettifier(right) | ||
|
@@ -263,7 +263,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def a[S <: AnyRef](bePropertyMatcher: BePropertyMatcher[S]): Matcher[S] = | ||
infix def a[S <: AnyRef](bePropertyMatcher: BePropertyMatcher[S]): Matcher[S] = | ||
new Matcher[S] { | ||
def apply(left: S): MatchResult = { | ||
val result = bePropertyMatcher(left) | ||
|
@@ -285,7 +285,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def a[S](aMatcher: AMatcher[S]): Matcher[S] = | ||
infix def a[S](aMatcher: AMatcher[S]): Matcher[S] = | ||
new Matcher[S] { | ||
def apply(left: S): MatchResult = aMatcher(left) | ||
override def toString: String = "be a " + Prettifier.default(aMatcher) | ||
|
@@ -300,7 +300,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def an(right: Symbol)(implicit prettifier: Prettifier, pos: source.Position): Matcher[AnyRef] = | ||
infix def an(right: Symbol)(implicit prettifier: Prettifier, pos: source.Position): Matcher[AnyRef] = | ||
new Matcher[AnyRef] { | ||
def apply(left: AnyRef): MatchResult = matchSymbolToPredicateMethod(left, right, true, false, prettifier, pos) | ||
override def toString: String = "be an " + Prettifier.default(right) | ||
|
@@ -316,7 +316,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def an[S <: AnyRef](bePropertyMatcher: BePropertyMatcher[S]): Matcher[S] = | ||
infix def an[S <: AnyRef](bePropertyMatcher: BePropertyMatcher[S]): Matcher[S] = | ||
new Matcher[S] { | ||
def apply(left: S): MatchResult = { | ||
val result = bePropertyMatcher(left) | ||
|
@@ -338,7 +338,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def an[S](anMatcher: AnMatcher[S]): Matcher[S] = | ||
infix def an[S](anMatcher: AnMatcher[S]): Matcher[S] = | ||
new Matcher[S] { | ||
def apply(left: S): MatchResult = anMatcher(left) | ||
override def toString: String = "be an " + Prettifier.default(anMatcher) | ||
|
@@ -352,7 +352,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def apply[U](spread: Spread[U]): Matcher[U] = | ||
infix def apply[U](spread: Spread[U]): Matcher[U] = | ||
new Matcher[U] { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I'm curious what syntax infix would support here? |
||
def apply(left: U): MatchResult = { | ||
MatchResult( | ||
|
@@ -373,7 +373,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def theSameInstanceAs(right: AnyRef): Matcher[AnyRef] = | ||
infix def theSameInstanceAs(right: AnyRef): Matcher[AnyRef] = | ||
new Matcher[AnyRef] { | ||
def apply(left: AnyRef): MatchResult = | ||
MatchResult( | ||
|
@@ -393,7 +393,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def apply(right: Boolean): Matcher[Boolean] = | ||
infix def apply(right: Boolean): Matcher[Boolean] = | ||
new Matcher[Boolean] { | ||
def apply(left: Boolean): MatchResult = | ||
MatchResult( | ||
|
@@ -413,7 +413,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def apply(o: Null): Matcher[AnyRef] = | ||
infix def apply(o: Null): Matcher[AnyRef] = | ||
new Matcher[AnyRef] { | ||
def apply(left: AnyRef): MatchResult = { | ||
MatchResult( | ||
|
@@ -436,7 +436,7 @@ final class BeWord { | |
* set should be ('empty) | ||
* ^ | ||
* </pre> | ||
def apply[T](right: AType[T]): Matcher[Any] = | ||
infix def apply[T](right: AType[T]): Matcher[Any] = | ||
new Matcher[Any] { | ||
def apply(left: Any): MatchResult = | ||
MatchResult( | ||
|
@@ -458,7 +458,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def apply(right: Symbol)(implicit prettifier: Prettifier, pos: source.Position): Matcher[AnyRef] = | ||
infix def apply(right: Symbol)(implicit prettifier: Prettifier, pos: source.Position): Matcher[AnyRef] = | ||
new Matcher[AnyRef] { | ||
def apply(left: AnyRef): MatchResult = matchSymbolToPredicateMethod(left, right, false, false, prettifier, pos) | ||
override def toString: String = "be (" + Prettifier.default(right) + ")" | ||
|
@@ -474,7 +474,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def apply[T](right: BeMatcher[T]): Matcher[T] = | ||
infix def apply[T](right: BeMatcher[T]): Matcher[T] = | ||
new Matcher[T] { | ||
def apply(left: T): MatchResult = right(left) | ||
override def toString: String = "be (" + Prettifier.default(right) + ")" | ||
|
@@ -488,7 +488,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def apply[T](bePropertyMatcher: BePropertyMatcher[T]): Matcher[T] = | ||
infix def apply[T](bePropertyMatcher: BePropertyMatcher[T]): Matcher[T] = | ||
new Matcher[T] { | ||
def apply(left: T): MatchResult = { | ||
val result = bePropertyMatcher(left) | ||
|
@@ -518,7 +518,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def apply(right: Any): Matcher[Any] = | ||
infix def apply(right: Any): Matcher[Any] = | ||
new Matcher[Any] { | ||
def apply(left: Any): MatchResult = { | ||
new EqualMatchResult( | ||
|
@@ -540,7 +540,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def apply(right: SortedWord): MatcherFactory1[Any, Sortable] = | ||
infix def apply(right: SortedWord): MatcherFactory1[Any, Sortable] = | ||
new MatcherFactory1[Any, Sortable] { | ||
def matcher[T <: Any : Sortable]: Matcher[T] = | ||
new Matcher[T] { | ||
|
@@ -566,7 +566,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def definedAt[A, U <: PartialFunction[A, _]](right: A): Matcher[U] = | ||
infix def definedAt[A, U <: PartialFunction[A, _]](right: A): Matcher[U] = | ||
new Matcher[U] { | ||
def apply(left: U): MatchResult = | ||
MatchResult( | ||
|
@@ -586,7 +586,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def thrownBy(code: => Unit) = new ResultOfBeThrownBy(Vector(() => code)) | ||
infix def thrownBy(code: => Unit) = new ResultOfBeThrownBy(Vector(() => code)) | ||
|
||
/** | ||
* This method enables the following syntax, where <code>fraction</code> refers to a <code>PartialFunction</code>: | ||
|
@@ -596,7 +596,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def apply[A, U <: PartialFunction[A, _]](resultOfDefinedAt: ResultOfDefinedAt[A]): Matcher[U] = | ||
infix def apply[A, U <: PartialFunction[A, _]](resultOfDefinedAt: ResultOfDefinedAt[A]): Matcher[U] = | ||
new Matcher[U] { | ||
def apply(left: U): MatchResult = | ||
MatchResult( | ||
|
@@ -618,7 +618,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
inline def apply(aType: ResultOfATypeInvocation[_]): Matcher[Any] = | ||
infix inline def apply(aType: ResultOfATypeInvocation[_]): Matcher[Any] = | ||
${ TypeMatcherMacro.aTypeMatcherImpl('{aType}) } | ||
|
||
/** | ||
|
@@ -629,7 +629,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
inline def apply(anType: ResultOfAnTypeInvocation[_]): Matcher[Any] = | ||
infix inline def apply(anType: ResultOfAnTypeInvocation[_]): Matcher[Any] = | ||
${ TypeMatcherMacro.anTypeMatcherImpl('{anType}) } | ||
|
||
/** | ||
|
@@ -640,7 +640,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def apply(readable: ReadableWord): MatcherFactory1[Any, Readability] = | ||
infix def apply(readable: ReadableWord): MatcherFactory1[Any, Readability] = | ||
new MatcherFactory1[Any, Readability] { | ||
def matcher[T <: Any : Readability]: Matcher[T] = | ||
new Matcher[T] { | ||
|
@@ -666,7 +666,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def apply(writable: WritableWord): MatcherFactory1[Any, Writability] = | ||
infix def apply(writable: WritableWord): MatcherFactory1[Any, Writability] = | ||
new MatcherFactory1[Any, Writability] { | ||
def matcher[T <: Any : Writability]: Matcher[T] = | ||
new Matcher[T] { | ||
|
@@ -692,7 +692,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def apply(empty: EmptyWord): MatcherFactory1[Any, Emptiness] = | ||
infix def apply(empty: EmptyWord): MatcherFactory1[Any, Emptiness] = | ||
new MatcherFactory1[Any, Emptiness] { | ||
def matcher[T <: Any : Emptiness]: Matcher[T] = | ||
new Matcher[T] { | ||
|
@@ -718,7 +718,7 @@ final class BeWord { | |
* ^ | ||
* </pre> | ||
**/ | ||
def apply(defined: DefinedWord): MatcherFactory1[Any, Definition] = | ||
infix def apply(defined: DefinedWord): MatcherFactory1[Any, Definition] = | ||
new MatcherFactory1[Any, Definition] { | ||
def matcher[T <: Any : Definition]: Matcher[T] = | ||
new Matcher[T] { | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove infix from methods with symbolic names, because it is not required for symbols.