forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix lack of type avoidance in argument lifting
We need to manually increase the nestingLevel of symbols created by EtaExpansion#lift to compensate for the fact that they will end up in a block. Fixes scala#15174.
- Loading branch information
1 parent
045e483
commit 495b7e8
Showing
3 changed files
with
42 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
trait Error | ||
sealed abstract class Codec[A] { | ||
type AvroType | ||
def encode(a: A): Either[Error, AvroType] | ||
// def decode(value: Any): Either[Error, A] | ||
} | ||
|
||
object Codec { | ||
type Aux[AvroType0, A] = Codec[A] { | ||
type AvroType = AvroType0 | ||
} | ||
|
||
final def instance[AvroType0, A]( | ||
encode: A => Either[Error, AvroType0], | ||
// decode: Any => Either[Error, A] | ||
): Codec.Aux[AvroType0, A] = ??? | ||
|
||
implicit final def option[A](implicit codec: Codec[A]): Codec[Option[A]] = ??? | ||
given Codec.Aux[Int, Int] = ??? | ||
} | ||
|
||
|
||
@main def test() = { | ||
implicit val codec: Codec[Option[Int]] = | ||
Codec.instance( | ||
Codec.option[Int].encode | ||
// expands to: | ||
// { | ||
// val a: Codec[Option[Int]] = Codec.option[Int](Codec.given_Aux_Int_Int) | ||
// a.encode | ||
// }, | ||
// Codec.option[Int].decode | ||
) | ||
} |