These are chat archives for fthomas/refined

9th
Jun 2017
Viktor Lövgren
@vlovgr
Jun 09 2017 19:58
@fthomas is there a known issue with refined's auto macro when used with 2.10.6 and macro paradise plugin? Gettings errors like the one described here: vlovgr/ciris#28
Frank S. Thomas
@fthomas
Jun 09 2017 21:10
@vlovgr No, I haven't seen that, but I can reproduce it in the REPL:
scala> case class Config(port: PortNumber)
defined class Config

scala> val port = RefType.applyRef[PortNumber](8080).right.toOption
port: Option[eu.timepit.refined.types.all.PortNumber] = Some(8080)

scala> Config(port = port getOrElse 4000)
<console>:50: error: exception during macro expansion: 
java.lang.ClassCastException: eu.timepit.refined.BooleanValidate$$anon$2 cannot be cast to eu.timepit.refined.api.Validate
    at eu.timepit.refined.macros.RefineMacro.impl(RefineMacro.scala:23)
    at eu.timepit.refined.macros.RefineMacro$.impl(RefineMacro.scala:9)

              Config(port = port getOrElse 4000)
                                           ^
Frank S. Thomas
@fthomas
Jun 09 2017 21:15
I'm not sure what is going on, even the basic stuff isn't working:
scala> 1: PosInt
<console>:47: error: exception during macro expansion: 
java.lang.ClassCastException: eu.timepit.refined.api.Validate$$anon$2 cannot be cast to eu.timepit.refined.api.Validate
    at eu.timepit.refined.macros.RefineMacro.impl(RefineMacro.scala:23)
    at eu.timepit.refined.macros.RefineMacro$.impl(RefineMacro.scala:9)
Viktor Lövgren
@vlovgr
Jun 09 2017 21:16
Interesting. And strange. You use the macro paradise plugin in refined's tests right?
Frank S. Thomas
@fthomas
Jun 09 2017 21:16
But this is covered by the tests and tut docs...
yes
Viktor Lövgren
@vlovgr
Jun 09 2017 21:18
so it's probably a REPL-related issue, since that's basically what tut runs?
Frank S. Thomas
@fthomas
Jun 09 2017 21:26
but refined's tut docs compile just fine with 2.10.6
Viktor Lövgren
@vlovgr
Jun 09 2017 21:34
yeah, but it looks like docs/tut in refined doesn't use the macro paradise plugin:
-deprecation 
-encoding UTF-8 
-feature 
-language:existentials 
-language:experimental.macros 
-language:higherKinds 
-language:implicitConversions 
-unchecked 
-Xfatal-warnings 
-Xfuture 
-Yno-adapted-args 
-Ywarn-numeric-widen 
-Ywarn-value-discard 
-Xlint
here's what it looks like for me when tut uses macro paradise:
-deprecation
-encoding UTF-8
-feature
-language:existentials
-language:higherKinds
-language:implicitConversions
-language:postfixOps
-unchecked
-Xfatal-warnings
-Yno-adapted-args
-Ywarn-dead-code
-Ywarn-numeric-widen
-Ywarn-value-discard
-Xfuture
-Xplugin:/Users/vlovgr/.ivy2/cache/org.scalamacros/paradise_2.10.6/jars/paradise_2.10.6-2.1.0.jar