Coder Social home page Coder Social logo

Comments (2)

fredemmott avatar fredemmott commented on September 27, 2024
use type Facebook\XHP\HTML\div;

function test(): void {
  $x = <div>{null}</div>;
}

This should be equivalent to <div></div>. Instead:

Typing[4110] Some elements in this collection are incompatible [1]
-> Expected XHPChild [2]
-> But got null [3]

src/test.hack:4:8
       2 |
       3 | function test(): void {
[1,3]  4 |   $x = <div>{null}</div>;
       5 | }

vendor/facebook/xhp-lib/src/core/Node.hack:52:17
      50 |   final public function __construct(
      51 |     KeyedTraversable<string, mixed> $attributes,
[2]   52 |     Traversable<\XHPChild> $children,
      53 |     dynamic ...$debug_info
      54 |   ) {

from xhp-lib.

jjergus avatar jjergus commented on September 27, 2024

Yep I included this as a breaking change in the release notes:

The typechecker now checks XHP constructor calls (bad calls would previously result in a runtime error, but wouldn’t be caught by the typechecker). This may reveal new errors, but it should be rare, since XHP class declarations rarely override the built-in default constructor, and are usually instantiated using the standard XHP syntax instead of explicit constructor calls.

Of course, whenever someone declares a bug to be rare, it will immediately happen.

Fixed in both v4 and v3, also tagged a release of each since it was blocking updating the docs site and other projects.

7d2d31e
e21656f

(also includes a test case)

from xhp-lib.

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.