Giter VIP home page Giter VIP logo

Comments (4)

JonoPrest avatar JonoPrest commented on July 1, 2024 1

You are right, it's just another case of a failed assertion making it to the end user instead of a readable error message. Would you want to improve it?

Sure I'll take look and improve the error message during the week 👌🏼

from rescript-compiler.

fhammerschmidt avatar fhammerschmidt commented on July 1, 2024

@JonoPrest could you have a look?

from rescript-compiler.

JonoPrest avatar JonoPrest commented on July 1, 2024

@JonoPrest could you have a look?

Hey @fhammerschmidt, I saw that assertion when I was fixing some issues on deriving accessors the other day. As far as I can see this has always been the behaviour of the @deriving(accessors).

We can only support support an accessor where the variant parameter is already a defined type. Or we need to generate types for them.

In this example:

@deriving(accessors)
type t = Struct({a: int})

the accessor would need to be:

let struct = (param_0: 'a) => Struct(param_0)

where 'a is unknown unless we generate it.

I think its just better to enforce that it gets defined like this to use accessors:

type structInner = {a: int}

@deriving(accessors)
type t = Struct(structInner)

So maybe the solution is just to improve the error messaging around the failure?

from rescript-compiler.

fhammerschmidt avatar fhammerschmidt commented on July 1, 2024

You are right, it's just another case of a failed assertion making it to the end user instead of a readable error message. Would you want to improve it?

from rescript-compiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.