Skip to content

Commit e8b8491

Browse files
committed
Fix and add to tests
1 parent 0a048fa commit e8b8491

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
824824
case _ => tree
825825
}
826826

827-
/** An extractor for eta expanded `mdef` an eta-expansion of a method reference? To recognize this, we use
827+
/** Is `mdef` an eta-expansion of a method reference? To recognize this, we use
828828
* the following criterion: A method definition is an eta expansion, if
829829
* it contains at least one term paramter, the parameter has a zero extent span,
830830
* and the right hand side is either an application or a closure with'

tests/neg/capt-wf.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test(c: Cap, other: String): Unit =
1313
val x3a: () -> String = s1
1414
val s2 = () => if x1 == null then "" else "abc"
1515
val x4: C^{s2} = ??? // OK
16-
val x5: C^{c, c} = ??? // error: redundant
16+
val x5: C^{c, c} = ??? // error: redundant // error: redundant
1717
// val x6: C^{c}^{c} = ??? // would be syntax error
1818
val x7: Cap^{c} = ??? // error: redundant
1919
// val x8: C^{c}^{cap} = ??? // would be syntax error

tests/pos-custom-args/captures/pairs.scala

+5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ object Monomorphic2:
3838
def fst: Cap^{cap[Pair]} ->{x} Unit = x
3939
def snd: Cap^{cap[Pair]} ->{y} Unit = y
4040

41+
class Pair2(x: Cap => Unit, y: Cap => Unit):
42+
def fst: Cap^{cap[Pair2]} => Unit = x
43+
def snd: Cap^{cap[Pair2]} => Unit = y
44+
4145
def test(c: Cap, d: Cap) =
4246
def f(x: Cap): Unit = if c == x then ()
4347
def g(x: Cap): Unit = if d == x then ()
@@ -46,3 +50,4 @@ object Monomorphic2:
4650
val x1c: Cap ->{c} Unit = x1
4751
val y1 = p.snd
4852
val y1c: Cap ->{d} Unit = y1
53+

0 commit comments

Comments
 (0)