Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Battle test with JSX PPX V4 #615

Closed
Closed
@mununki

Description

@mununki
  • 1. You forgot to handle a possible case here, for example:
// original
@react.component
let make = (~height, ~width, ~fill, ~className=?) => body

// error message
You forgot to handle a possible case here, for example: 
  {height: _, width: _, fill: Some(_), className: None, _}
| {height: _, width: _, fill: None, className: Some(_), _}
  • 2. The type variable name '_disabled is not allowed in programs
// original
@react.component
let make = (~_disabled=?, ()) => body
  • 3. A type parameter occurs several times
  • 4. Values do not match between intf and impl
let make: props<option<string>, 'a, 'b, 'c> => React.element
is not included in
let make: React.componentLike<
props<string, string, int, React.element>
  • 5. At most one component definition per module or one gets an error of type props being defined multiple times "Multiple definition of the type name props".
  • 6. Explicit type annotation for optional arg in definition
    This issue seems related to 4
let make = (~x: option<int>=?) => body
// generated
type props<'x> = {key?: string, x?: 'x}
let make = ({?x, _}: props<option<int>>) => body
// error type mismatch option<int> vs. option<option<int>>
  • 7. Conversion for the alias
let make = (~x as y) => body
  • 8. Backward compatibility for passing the optional expression to prop
    This expression seems not working with V4, should work in different expression.
x=?{a->returnOption} ❌ 

x=?{
  let _ = ()
  a->returnOption
} ⭕ 
  • 9. Raise error with loc

  • 10. If a component is calledfoo not make the ppx tries to call make.

  • 11. Error without location when a required prop is not supplied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions