File tree Expand file tree Collapse file tree 6 files changed +132
-3
lines changed
scaladoc/src/dotty/tools/scaladoc Expand file tree Collapse file tree 6 files changed +132
-3
lines changed Original file line number Diff line number Diff line change
1
+ package dummy
2
+
3
+ import language .experimental .captureChecking
4
+ import caps .*
5
+
6
+ trait Arrows :
7
+ val a : AnyRef ^
8
+ val b : AnyRef ^
9
+ val c : AnyRef ^
10
+
11
+ val purev : Int -> Int
12
+ val purev2 : Int -> {} Int
13
+ val impurev : Int => Int
14
+ val impurev2 : Int -> {a,b,c} Int
15
+ val impurev3 : Int -> {a,b,c} Int => Int
16
+
17
+ def pure (f : Int -> Int ): Int
18
+ def pure2 (f : Int -> {} Int ): Int
19
+ def impure (f : Int => Int ): Int
20
+ def impure2 (f : Int -> {a,b,c} Int ): Int
21
+ def impure3 (f : Int -> {a,b,c} Int => Int ): Int
22
+
23
+ def uses (@ use a : AnyRef ^ ): Any
24
+ def uses2 (@ use x : AnyRef ^ {a}, @ use y : AnyRef ^ {b}): Any
25
+
26
+ def consumes (@ consume a : AnyRef ^ ): Any
27
+ def consumes2 (@ consume x : AnyRef ^ {a}, @ consume y : AnyRef ^ {b}): Any
28
+
29
+ def usesAndConsumes (@ use a : AnyRef ^ , @ consume b : AnyRef ^ ): Any
30
+ def usesAndConsumes2 (@ use @ consume x : AnyRef ^ {a}): Any
31
+ def consumesAndUses (@ consume @ use x : AnyRef ^ {a}): Any
32
+
33
+ def byNamePure (f : -> Int ): Int
34
+ def byNameImpure (f : -> {a,b,c} Int ): Int
35
+ def byNameImpure2 (f : => Int ): Int
Original file line number Diff line number Diff line change
1
+ package dummy
2
+
3
+ import language .experimental .captureChecking
4
+
5
+ trait Test :
6
+ type T [- C ^ ]
7
+ type U [+ C ^ ]
8
+ type C ^
9
+ type D ^
10
+ def foo [C ^ ](x : T [C ]): Unit
11
+ def bar (x : T [{}]): Unit
12
+ def baz (x : T [{caps.cap}]): Unit
13
+ def foo2 [C ^ ](x : U [C ]): Unit
14
+ def bar2 (x : U [{}]): Unit
15
+ def baz2 (x : U [{caps.cap}]): Unit
16
+ def test [E ^ , F ^ >: {caps.cap} <: {}](x : T [E ], y : U [F ]): Unit
Original file line number Diff line number Diff line change
1
+ package dummy
2
+
3
+ import language .experimental .captureChecking
4
+ // Showing a problem with recursive references
5
+ object CollectionStrawMan5 {
6
+
7
+ /** Base trait for generic collections */
8
+ trait Iterable [+ A ] extends IterableLike [A ] {
9
+ def iterator : Iterator [A ]^ {this }
10
+ def coll : Iterable [A ]^ {this } = this
11
+ }
12
+
13
+ trait IterableLike [+ A ]:
14
+ def coll : Iterable [A ]^ {this }
15
+ def partition (p : A => Boolean ): Unit =
16
+ val pn = Partition (coll, p)
17
+ ()
18
+
19
+ /** Concrete collection type: View */
20
+ trait View [+ A ] extends Iterable [A ] with IterableLike [A ]
21
+
22
+ case class Partition [A ](val underlying : Iterable [A ]^ , p : A => Boolean ) {
23
+
24
+ class Partitioned (expected : Boolean ) extends View [A ]:
25
+ this : Partitioned ^ {Partition .this } =>
26
+ def iterator : Iterator [A ]^ {this } =
27
+ underlying.iterator.filter((x : A ) => p(x) == expected)
28
+
29
+ val left : Partitioned ^ {Partition .this } = Partitioned (true )
30
+ val right : Partitioned ^ {Partition .this } = Partitioned (false )
31
+ }
32
+
33
+
34
+ }
Original file line number Diff line number Diff line change
1
+ import sbt ._
2
+ import sbt .io .IO
3
+
4
+ import sbt .dsl .LinterLevel .Ignore
5
+
6
+ lazy val compileSrcTree = taskKey[Unit ](" Example project" )
7
+
8
+ compileSrcTree := {
9
+ val log = streams.value.log
10
+ val baseDir = baseDirectory.value
11
+ val srcTreeDir = baseDir / " local" / " project"
12
+ val outDir = baseDir / " local" / " out"
13
+
14
+ IO .delete(outDir)
15
+ IO .createDirectory(outDir) // mkdir -p
16
+
17
+ val sources : Seq [String ] =
18
+ (srcTreeDir ** " *.scala" ).get.map(_.getPath) // find all .scala
19
+
20
+ if (sources.isEmpty)
21
+ streams.value.log.warn(s " No .scala files found under $srcTreeDir" )
22
+ else {
23
+ val cmd = (" scalac" +: " -d" +: outDir.getPath +: sources).mkString(" " )
24
+ Command .process(cmd, state.value)
25
+ }
26
+ }
27
+
28
+ lazy val ensureApiDir = taskKey[Unit ](" Create <repo>/local/api if it’s missing" )
29
+
30
+ ensureApiDir := {
31
+ val dir = (ThisBuild / baseDirectory).value / " local" / " api"
32
+ IO .createDirectory(dir)
33
+ }
34
+
35
+ addCommandAlias(
36
+ " myrefresh" ,
37
+ " ;compileSrcTree; ensureApiDir ; scaladoc/runMain dotty.tools.scaladoc.Main -siteroot /dev/null -project Foo -project-version 0.0.1 -d local/api local/out"
38
+ )
39
+
40
+ addCommandAlias(
41
+ " myscaladoc" ,
42
+ " ; ensureApiDir ; scaladoc/runMain dotty.tools.scaladoc.Main -siteroot /dev/null -project Foo -project-version 0.0.1 -d local/api local/out"
43
+ )
Original file line number Diff line number Diff line change @@ -47,8 +47,9 @@ def decomposeCaptureRefs(using qctx: Quotes)(typ0: qctx.reflect.TypeRepr): Optio
47
47
case t @ ThisType (_) => buffer += t; true
48
48
case t @ TermRef (_, _) => buffer += t; true
49
49
case t @ ParamRef (_, _) => buffer += t; true
50
+ case t if t.typeSymbol == defn.NothingClass => true
50
51
// TODO: are atoms only ever the above? Then we could refine the return type
51
- case _ => report.warning(s " Unexpected type tree $typ while trying to extract capture references from $typ0" ); System .exit( 1 ); false // TODO remove warning eventually
52
+ case _ => report.warning(s " Unexpected type tree $typ while trying to extract capture references from $typ0" ); false // TODO remove warning eventually
52
53
if traverse(typ0) then Some (buffer.toList) else None
53
54
end decomposeCaptureRefs
54
55
Original file line number Diff line number Diff line change @@ -109,8 +109,8 @@ trait TypesSupport:
109
109
case List (ref) if ref.isCaptureRoot =>
110
110
keyword(" => " ) :: inner(tpe)
111
111
case refs =>
112
- keyword(" ->" ) :: (renderCaptureSet(refs) ++ inner(tpe))
113
- case ByNameType (tpe) => keyword(" => " ) :: inner(tpe) // FIXME: does it need change for CC?
112
+ keyword(" ->" ) :: (renderCaptureSet(refs) ++ (plain( " " ) :: inner(tpe) ))
113
+ case ByNameType (tpe) => keyword(" =>!! " ) :: inner(tpe) // FIXME: does it need change for CC?
114
114
case ConstantType (constant) =>
115
115
plain(constant.show).l
116
116
case ThisType (tpe) =>
You can’t perform that action at this time.
0 commit comments