@@ -86,7 +86,7 @@ extension (using quotes: Quotes)(lhs: quotes.reflect.TypeRepr)
86
86
case ' [head *: tail] =>
87
87
recur(TypeRepr .of[tail], TypeRepr .of[head] :: args)
88
88
case ' [EmptyTuple ] => args.reverse
89
- case ' [t] =>
89
+ case ' [t] =>
90
90
report.errorAndAbort(s " Expecting a tuple, but found ${Type .show[t]}" )
91
91
if (lhs.show == " null" )
92
92
report.errorAndAbort(s " Expecting a tuple, but found null " )
@@ -332,7 +332,7 @@ extension [T](seq: Iterable[T])
332
332
f : T => P ,
333
333
res : List [(P , Iterable [T ])]
334
334
): Seq [(P , Iterable [T ])] = seq.headOption match
335
- case None => res.reverse
335
+ case None => res.reverse
336
336
case Some (h) =>
337
337
val key = f(h)
338
338
val subseq = seq.takeWhile(f(_) equals key)
@@ -460,7 +460,32 @@ object AnnotatedWith:
460
460
end annotWithMacro
461
461
end AnnotatedWith
462
462
463
- def osIsWindows : Boolean = sys.props(" os.name" ).toLowerCase.contains(" windows" )
463
+ lazy val osIsWindows : Boolean = sys.props(" os.name" ).toLowerCase.contains(" windows" )
464
+ lazy val osIsLinux : Boolean = sys.props(" os.name" ).toLowerCase.contains(" linux" )
465
+ lazy val osIsWSL : Boolean =
466
+ if (osIsLinux)
467
+ import scala .io .Source
468
+ try
469
+ val procVersion = Source .fromFile(" /proc/version" ).getLines().mkString
470
+ procVersion.contains(" microsoft-standard" )
471
+ catch
472
+ case _ : Exception => false
473
+ else false
474
+ // checks if the program is accessible to the current shell
475
+ def programIsAccessible (cmd : String ): Boolean =
476
+ import sys .process .*
477
+ try
478
+ if (osIsWindows)
479
+ s " where $cmd" .!! .nonEmpty
480
+ else
481
+ val result = s " which $cmd" .!! .trim()
482
+ // reject windows programs running from WSL
483
+ if (result.nonEmpty && osIsWSL)
484
+ ! result.matches(""" /mnt/[a-zA-Z]/.*""" )
485
+ else
486
+ result.nonEmpty
487
+ catch
488
+ case _ : Exception => false
464
489
465
490
// trait CompiletimeErrorPos[M <: String, S <: Int, E <: Int]
466
491
// object CompiletimeErrorPos:
0 commit comments