We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Using.resource
1 parent 39717f1 commit b022b55Copy full SHA for b022b55
compiler/test/dotty/tools/utils.scala
@@ -47,11 +47,7 @@ def assertThrows[T <: Throwable: ClassTag](p: T => Boolean)(body: => Any): Unit
47
end assertThrows
48
49
def toolArgsFor(files: List[JPath], charset: Charset = UTF_8): List[String] =
50
- files.flatMap(path => toolArgsParse {
51
- val stream = Files.lines(path, charset)
52
- try stream.limit(10).toScala(List)
53
- finally stream.close()
54
- })
+ files.flatMap(path => toolArgsParse(resource(Files.lines(path, charset))(_.limit(10).toScala(List))))
55
56
// Inspect the first 10 of the given lines for compiler options of the form
57
// `// scalac: args`, `/* scalac: args`, ` * scalac: args`.
0 commit comments