hmemcpy / zio-clippy Goto Github PK
View Code? Open in Web Editor NEWA Scala compiler plugin for better ZIO type mismatch errors.
License: Apache License 2.0
A Scala compiler plugin for better ZIO type mismatch errors.
License: Apache License 2.0
ZIO Type Mismatch
Your effect requires the following environment, but it was not provided:
❯ grist.GristClient
Your effect has an error type mismatch:
❯ Required: twilio.CallTree.Failure
❯ Found : Either[String
Your effect has a return type mismatch:
❯ Required: twilio.CallTree[R
❯ Found : Throwable
--------------------------------------------------------------------------------
type mismatch;
found : kupasyomtov.igudbneitorah.Main.MainMenuOptions.Value => zio.ZIO[grist.GristClient with twilio.CallInfo,Either[String,Throwable],twilio.CallTree.Gather[Nothing]]
required: kupasyomtov.igudbneitorah.Main.MainMenuOptions.Value => zio.ZIO[twilio.CallInfo with R,twilio.CallTree.Failure,twilio.CallTree[R]]
(which expands to) kupasyomtov.igudbneitorah.Main.MainMenuOptions.Value => zio.ZIO[twilio.CallInfo with R,scala.util.Either[String,Throwable],twilio.CallTree[R]]
[29:62]
(no image, from memory:)
Found: A]
Expected: B]
seems to be a bad regex
Instead of supporting each version independently, make sure that ZIOPlugin picks up the correct version of the compiler.
Example:
trait Base {
type Env
def makeEnv: ZLayer[Any, Nothing, Env]
}
object ZMain extends Base {
override type Env = String
override def makeEnv: ZLayer[Any with Long, Nothing, String] = ZLayer.succeed("42")
}
Output:
billing/billing/billing-tms/app/src/ZMain.scala:34: error: incompatible type in overriding
def makeEnv: zio.ZLayer[Any,Nothing,ru.yandex.vertis.billing.tms.ZMain0.Env] (defined in trait Base);
found : zio.ZLayer[Any with Long,Nothing,String]
required: zio.ZLayer[Any,Nothing,ru.yandex.vertis.billing.tms.ZMain0.Env]
(which expands to) zio.ZLayer[Any,Nothing,String]
override def makeEnv: ZLayer[Any with Long, Nothing, String] = ZLayer.succeed("42")
^
zio.ZLayer[Any with Long,Nothing,String] <: zio.ZLayer[Any,Nothing,ru.yandex.vertis.billing.tms.ZMain0.Env]?
Looks like magic regex ignores such errors because it is incompatible type in overriding
, not a type mismatch
🤔
There are several ZIO-like type aliases that should probably be hardcoded (base ZIO aliases). The rest (e.g. ZPure, ZFlow, etc) could be added to an external resource mapping.
Hi,
We've tried to add it to our project, but don't get the expected output. We just get the normal error output.
This Scastie https://scastie.scala-lang.org/JrOm5GVAQ8Wn29kgpcUl2w shows the same behaviour.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.