Skip to content
This repository was archived by the owner on Nov 5, 2022. It is now read-only.

invariant case object encoding #9

Merged
merged 3 commits into from
Apr 11, 2018
Merged

invariant case object encoding #9

merged 3 commits into from
Apr 11, 2018

Conversation

fommil
Copy link
Contributor

@fommil fommil commented Apr 10, 2018

close #8

@fommil
Copy link
Contributor Author

fommil commented Apr 10, 2018

@jdegoes encoding you may not have been aware of ^^^

@fommil
Copy link
Contributor Author

fommil commented Apr 10, 2018

(I think we can easily create a compiler plugin that does this optimisation automatically)

@jdegoes
Copy link
Member

jdegoes commented Apr 11, 2018

@fommil This looks good. I'll fix this in 8.

@xuwei-k
Copy link
Member

xuwei-k commented Apr 11, 2018

[info] Compiling 12 Scala sources to /home/travis/build/scalaz/effect/target/scala-2.12/classes ...
[error] /home/travis/build/scalaz/effect/src/main/scala/scalaz/ioeffect/RTS.scala:535:34: unreachable code
[error]                             eval = false
[error]                                  ^
[error] 5 errors found
[error] (Compile / compileIncremental) Compilation failed

🤔

https://travis-ci.org/scalaz/ioeffect/builds/364861651#L515

@fommil
Copy link
Contributor Author

fommil commented Apr 11, 2018

@xuwei-k I have no idea what is going on there... looks like a compiler bug.

@jdegoes is the Later codepath covered in the tests? If so, I'll turn off the broken compiler warning.

@fommil
Copy link
Contributor Author

fommil commented Apr 11, 2018

I raised a bug report with scalac. I suspect a bug in the interplay between this encoding, var and try / catch.

If ever there was a way to start the day depressed, I recommend discovering yet another scalac cliff edge.

@fommil fommil added the help wanted Extra attention is needed label Apr 11, 2018
@emilypi
Copy link
Contributor

emilypi commented Apr 11, 2018

@fommil I was confused about that bug as well when I reviewed the code and saw that it was failing for dead code. It seemed to be a total pattern match, so i'm left wondering why it's a problem. I'd be interested to see why scalac things that's dead code.

@jbgi
Copy link
Member

jbgi commented Apr 11, 2018

in the meantime @silent can be use to suppress the warning.

@hrhino
Copy link
Member

hrhino commented Apr 11, 2018

fommil and others added 2 commits April 11, 2018 14:57
See scala/bug#10822.

This makes the pattern matcher think that `Later()` behaves covariantly,
so it could match any `AsyncReturn[A]`.
@hrhino
Copy link
Member

hrhino commented Apr 11, 2018

src/main/scala/scalaz/ioeffect/AsyncReturn.scala:34:38: error: [DisableSyntax.covariant] Covariant types could lead to error-prone situations.

hahahahahahahahaha.

@fommil
Copy link
Contributor Author

fommil commented Apr 11, 2018

@fommil
Copy link
Contributor Author

fommil commented Apr 11, 2018

(I'll do it later)

@fommil fommil removed the help wanted Extra attention is needed label Apr 11, 2018
@fommil fommil merged commit eef92e7 into scalaz:master Apr 11, 2018
@fommil fommil deleted the no-nothing branch April 11, 2018 21:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use the scalaz-core encoding of invariant case objects
7 participants