-   Notifications  You must be signed in to change notification settings 
- Fork 1.1k
Closed
Closed
Copy link
Labels
area:context functionsIssues tied to context functions.Issues tied to context functions.area:inlineitype:bug
Description
Compiler version
Tested it with 3.3.3, 3.3.4-RC1, 3.4.2, 3.5.0-RC4
Minimized code
def oops(msg: String) = sys.error(msg) class Zone object Zone: inline def apply[T](inline f: Zone ?=> T): T = f(using new Zone) inline def zone[A](inline f: Zone ?=> A) = Zone.apply(z => f(using z)) @main def hello = // this swallows exceptions! zone(oops("here")) // this doesn't Zone(oops("not here")) Output
Exception in thread "main"java.lang.RuntimeException: not here at scala.sys.package$.error(Unknown Source) at test$package$.oops(Unknown Source) at test$package$.hello(Unknown Source) at hello.main(Unknown Source) at <none>.main(Unknown Source) Expectation
I expected the first call to oops to throw the error, but it's quietly swallowed. This is extremely unsettling, I have no idea what other places I have where exceptions are swallowed like this
Noticed this when converting a project from SN 0.4 to SN 0.5 which ships a Zone.apply that uses context functions out of the box (I used to have zone helper before, and it worked fine)
He-Pin and sideeffffect
Metadata
Metadata
Assignees
Labels
area:context functionsIssues tied to context functions.Issues tied to context functions.area:inlineitype:bug