Skip to content

Commit

Permalink
Use context function for Env in scalaJVM
Browse files Browse the repository at this point in the history
  • Loading branch information
avdv committed Jun 11, 2024
1 parent 94477d2 commit 00e782a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions jvm/src/main/scala/de/bley/scalals/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@ package de.bley
package scalals:
sealed trait Env

package object scalals:
object EmptyEnv extends Env

@inline
def Env[T](f: Env => T) = f(EmptyEnv)
object Env extends Env:
inline def apply[T](inline f: Env ?=> T): T = f(using this)
2 changes: 1 addition & 1 deletion native/src/main/scala/de/bley/scalals/Core.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object FileInfo:
// FIXME: crashes with a scala.scalanative.runtime.UndefinedBehaviorError
// val lookupService = FileSystems.getDefault.getUserPrincipalLookupService

def apply(path: Path, dereference: Boolean)(implicit z: Env) =
def apply(path: Path, dereference: Boolean)(using e: Env) =
val info =
val buf = alloc[stat.stat]()
val err =
Expand Down

0 comments on commit 00e782a

Please sign in to comment.