Skip to content

Commit

Permalink
Fix and add to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Sep 4, 2023
1 parent 0a048fa commit e8b8491
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/ast/TreeInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
case _ => tree
}

/** An extractor for eta expanded `mdef` an eta-expansion of a method reference? To recognize this, we use
/** Is `mdef` an eta-expansion of a method reference? To recognize this, we use
* the following criterion: A method definition is an eta expansion, if
* it contains at least one term paramter, the parameter has a zero extent span,
* and the right hand side is either an application or a closure with'
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/capt-wf.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test(c: Cap, other: String): Unit =
val x3a: () -> String = s1
val s2 = () => if x1 == null then "" else "abc"
val x4: C^{s2} = ??? // OK
val x5: C^{c, c} = ??? // error: redundant
val x5: C^{c, c} = ??? // error: redundant // error: redundant
// val x6: C^{c}^{c} = ??? // would be syntax error
val x7: Cap^{c} = ??? // error: redundant
// val x8: C^{c}^{cap} = ??? // would be syntax error
Expand Down
5 changes: 5 additions & 0 deletions tests/pos-custom-args/captures/pairs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ object Monomorphic2:
def fst: Cap^{cap[Pair]} ->{x} Unit = x
def snd: Cap^{cap[Pair]} ->{y} Unit = y

class Pair2(x: Cap => Unit, y: Cap => Unit):
def fst: Cap^{cap[Pair2]} => Unit = x
def snd: Cap^{cap[Pair2]} => Unit = y

def test(c: Cap, d: Cap) =
def f(x: Cap): Unit = if c == x then ()
def g(x: Cap): Unit = if d == x then ()
Expand All @@ -46,3 +50,4 @@ object Monomorphic2:
val x1c: Cap ->{c} Unit = x1
val y1 = p.snd
val y1c: Cap ->{d} Unit = y1

0 comments on commit e8b8491

Please sign in to comment.