-
Notifications
You must be signed in to change notification settings - Fork 48.6k
[compiler] Errors in earlier functions dont stop subsequent compilation #30844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
josephsavona
merged 6 commits into
gh/josephsavona/53/base
from
gh/josephsavona/53/head
Aug 30, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f889583
[compiler] Errors in earlier functions dont stop subsequent compilation
josephsavona edb800b
Update on "[compiler] Errors in earlier functions dont stop subsequen…
josephsavona 033906d
Update on "[compiler] Errors in earlier functions dont stop subsequen…
josephsavona 2ae6178
Update on "[compiler] Errors in earlier functions dont stop subsequen…
josephsavona 35488e7
Update on "[compiler] Errors in earlier functions dont stop subsequen…
josephsavona bbdd01d
Update on "[compiler] Errors in earlier functions dont stop subsequen…
josephsavona File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
.../src/__tests__/fixtures/compiler/multiple-components-first-is-invalid.expect.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
## Input | ||
|
||
```javascript | ||
// @panicThreshold(none) | ||
import {useHook} from 'shared-runtime'; | ||
|
||
function InvalidComponent(props) { | ||
if (props.cond) { | ||
useHook(); | ||
} | ||
return <div>Hello World!</div>; | ||
} | ||
|
||
function ValidComponent(props) { | ||
return <div>{props.greeting}</div>; | ||
} | ||
|
||
``` | ||
|
||
## Code | ||
|
||
```javascript | ||
import { c as _c } from "react/compiler-runtime"; // @panicThreshold(none) | ||
import { useHook } from "shared-runtime"; | ||
|
||
function InvalidComponent(props) { | ||
if (props.cond) { | ||
useHook(); | ||
} | ||
return <div>Hello World!</div>; | ||
} | ||
|
||
function ValidComponent(props) { | ||
const $ = _c(2); | ||
let t0; | ||
if ($[0] !== props.greeting) { | ||
t0 = <div>{props.greeting}</div>; | ||
$[0] = props.greeting; | ||
$[1] = t0; | ||
} else { | ||
t0 = $[1]; | ||
} | ||
return t0; | ||
} | ||
|
||
``` | ||
|
||
### Eval output | ||
(kind: exception) Fixture not implemented |
13 changes: 13 additions & 0 deletions
13
...in-react-compiler/src/__tests__/fixtures/compiler/multiple-components-first-is-invalid.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// @panicThreshold(none) | ||
import {useHook} from 'shared-runtime'; | ||
|
||
function InvalidComponent(props) { | ||
if (props.cond) { | ||
useHook(); | ||
} | ||
return <div>Hello World!</div>; | ||
} | ||
|
||
function ValidComponent(props) { | ||
return <div>{props.greeting}</div>; | ||
} |
39 changes: 39 additions & 0 deletions
39
...__/fixtures/compiler/unclosed-eslint-suppression-skips-all-components.expect.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
## Input | ||
|
||
```javascript | ||
// @panicThreshold(none) | ||
|
||
// unclosed disable rule should affect all components | ||
/* eslint-disable react-hooks/rules-of-hooks */ | ||
|
||
function ValidComponent1(props) { | ||
return <div>Hello World!</div>; | ||
} | ||
|
||
function ValidComponent2(props) { | ||
return <div>{props.greeting}</div>; | ||
} | ||
|
||
``` | ||
|
||
## Code | ||
|
||
```javascript | ||
// @panicThreshold(none) | ||
|
||
// unclosed disable rule should affect all components | ||
/* eslint-disable react-hooks/rules-of-hooks */ | ||
|
||
function ValidComponent1(props) { | ||
return <div>Hello World!</div>; | ||
} | ||
|
||
function ValidComponent2(props) { | ||
return <div>{props.greeting}</div>; | ||
} | ||
|
||
``` | ||
|
||
### Eval output | ||
(kind: exception) Fixture not implemented |
12 changes: 12 additions & 0 deletions
12
...piler/src/__tests__/fixtures/compiler/unclosed-eslint-suppression-skips-all-components.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// @panicThreshold(none) | ||
|
||
// unclosed disable rule should affect all components | ||
/* eslint-disable react-hooks/rules-of-hooks */ | ||
|
||
function ValidComponent1(props) { | ||
return <div>Hello World!</div>; | ||
} | ||
|
||
function ValidComponent2(props) { | ||
return <div>{props.greeting}</div>; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transformed despite the error in the component above