Skip to content

[Compiler Bug]: (BuildHIR::lowerStatement) Support ThrowStatement inside of try/catch #35605

@a0m0rajab

Description

@a0m0rajab

What kind of issue is this?

  • React Compiler core (the JS output is incorrect, or your app works incorrectly after optimization)
  • babel-plugin-react-compiler (build issue installing or using the Babel plugin)
  • eslint-plugin-react-hooks (build issue installing or using the eslint plugin)
  • react-compiler-healthcheck (build issue installing or using the healthcheck script)

Link to repro

https://playground.react.dev/#N4Igzg9grgTgxgUxALhAgHgBwjALgAgBMEAzAQygBsCSoA7OXASwjvwBUyAjACgEp8wADpt8cVmAKEyuMvgC8+ANoBdEfnxkwATwb5aDZq3wBzBLgAKMCCSaUE-Qeo35cMbU9EuXTEvh4IMNYwAsJe3i64ABbWAO74gcEA3M4R+AC+qRliMnBR-ok4oVka4nSQ9gB0lBAmAUFFWZmizSLOMOawbDxZADwAfCXsCJJ9APSDonwpdM0gADQgZbYmKCBMALbYeK7amAiC+BaUUCZMdADymEbl2STWG-gA5FzcCJQAtJgnZ3QfHWRGB9xFs7IExoQmJInjMRDwwhoxmMQZg7DIWHQALIQYjIfBCEBkSiUAkidL4MDosC2EZHH7nK43MDTBbgKIQWIASTouECdCJYBQ5EoYAQ6SAA

Repro steps

  1. go to the playground
  2. use the next code:
export default function Tab() {
  const data = []
  async function getProfile() {
    try {
        if (error) {
          throw error;
        }
    } catch (error) {
      console.log(error)
    }
  }


  return (
    <>
     Test
    </>
  );
}

you will see the error

How often does this bug happen?

Every time

What version of React are you using?

latest

What version of React Compiler are you using?

latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugType: Bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions