-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extra check to avoid converting block expressions on the rhs of a sym…
…bolic infix expression. Tests added for: * Original cast as per the ticket should not be changed * Similar match statement that should update * Code blocks in this position, as opposed to a partial function, cant update here * Simple change that should apply but in a code position where the op stack is nonempty * Equivalent code, but passing in the partial function as a single parameter, again, not updating
- Loading branch information
Lucy Martin
committed
Apr 11, 2024
1 parent
43ed9fd
commit 43d33a0
Showing
4 changed files
with
135 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
object Reactions: | ||
def main: Unit = | ||
Reactions += { | ||
case 0 => | ||
case 1 => | ||
} | ||
|
||
Reactions run: | ||
case 0 => | ||
case 1 => | ||
|
||
Reactions run_+ : | ||
case 0 => | ||
case 1 => | ||
|
||
Reactions `+=`: | ||
case 0 => | ||
case 1 => | ||
|
||
def bar: Int = ??? | ||
|
||
bar match | ||
case 0 => | ||
case 1 => | ||
|
||
def partPartial(i: Int): PartialFunction[Int, Unit] = | ||
case `i` => | ||
|
||
Reactions += { | ||
val pp1 = partPartial(1) | ||
val pp2 = partPartial(2) | ||
def codeBlock = | ||
??? | ||
??? | ||
pp1 orElse pp2 | ||
} | ||
|
||
val partialFunction = partPartial(1) orElse partPartial(2) | ||
Reactions += { | ||
partialFunction | ||
} | ||
|
||
def +=(f: PartialFunction[Int, Unit]) = | ||
??? | ||
|
||
def run (f: PartialFunction[Int, Unit]) = | ||
??? | ||
|
||
def run_+ (f: PartialFunction[Int, Unit]) = | ||
??? | ||
|
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,62 @@ | ||
object Reactions { | ||
def main: Unit = { | ||
Reactions += { | ||
case 0 => | ||
case 1 => | ||
} | ||
|
||
Reactions run { | ||
case 0 => | ||
case 1 => | ||
} | ||
|
||
Reactions run_+ { | ||
case 0 => | ||
case 1 => | ||
} | ||
|
||
Reactions `+=` { | ||
case 0 => | ||
case 1 => | ||
} | ||
|
||
def bar: Int = ??? | ||
|
||
bar match { | ||
case 0 => | ||
case 1 => | ||
} | ||
|
||
def partPartial(i: Int): PartialFunction[Int, Unit] = { | ||
case `i` => | ||
} | ||
|
||
Reactions += { | ||
val pp1 = partPartial(1) | ||
val pp2 = partPartial(2) | ||
def codeBlock = { | ||
??? | ||
??? | ||
} | ||
pp1 orElse pp2 | ||
} | ||
|
||
val partialFunction = partPartial(1) orElse partPartial(2) | ||
Reactions += { | ||
partialFunction | ||
} | ||
} | ||
|
||
def +=(f: PartialFunction[Int, Unit]) = { | ||
??? | ||
} | ||
|
||
def run (f: PartialFunction[Int, Unit]) = { | ||
??? | ||
} | ||
|
||
def run_+ (f: PartialFunction[Int, Unit]) = { | ||
??? | ||
} | ||
|
||
} |