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 capture set variable installation in Setup (scala#18885)
Fixes scala#18881
- Loading branch information
Showing
3 changed files
with
32 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import language.experimental.captureChecking | ||
|
||
trait Resource | ||
def id[X](x: X): x.type = x | ||
def foo[M <: Resource](r: M^): Unit = id(r) // was error, should be ok | ||
def bar[M](r: M^): Unit = id(r) // ok |
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,16 @@ | ||
import language.experimental.captureChecking | ||
|
||
trait Builder[-A, +C] | ||
trait BuildFrom[-From, -A, +C] { | ||
def newBuilder(from: From): Builder[A, C] | ||
} | ||
|
||
trait Future[+T] { this: Future[T]^ => | ||
import Future.* | ||
def foldLeft[R](r: R): R = r | ||
def traverse[A, B, M[X] <: IterableOnce[X]](in: M[A]^, bf: BuildFrom[M[A]^, B, M[B]^]): Unit = | ||
foldLeft(successful(bf.newBuilder(in))) | ||
} | ||
object Future { | ||
def successful[T](result: T): Future[T] = ??? | ||
} |