File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -43,3 +43,35 @@ object Unmatched:
4343 case Ident (name) =>
4444 case _ =>
4545 e
46+
47+ trait Ctx
48+ case class K (i : Int )(using val ctx : Ctx ) // nowarn
49+ class L (val i : Int )(using val ctx : Ctx ) // nowarn
50+ class M (val i : Int )(using ctx : Ctx ) // warn
51+
52+ package givens:
53+
54+ trait X :
55+ def doX : Int
56+
57+ trait Y :
58+ def doY : String
59+
60+ given X :
61+ def doX = 7
62+
63+ given X => Y : // warn protected param to given class
64+ def doY = " 7"
65+ /* desugared. It is protected so that its type can be used in member defs without leaking.
66+ * possibly it should be protected only for named parameters.
67+ given class given_Y(using x$1: givens.X) extends Object(), givens.Y {
68+ protected given val x$1: givens.X
69+ def doY: String = "7"
70+ }
71+ final given def given_Y(using x$1: givens.X): givens.given_Y =
72+ new givens.given_Y(using x$1)()
73+ */
74+
75+ given namely : (x : X ) => Y : // warn protected param to given class
76+ def doY = " 8"
77+ end givens
You can’t perform that action at this time.
0 commit comments