Skip to content

Commit 79c9b38

Browse files
rchen152meta-codesync[bot]
authored andcommitted
Default [unreachable] to warn
Summary: No other Python type checker I checked errors on unreachable code by default. (pyright/basedpyright greys it out.) Furthermore, this is neither a type error nor a runtime error. I suggest we downgrade it to a warning. Reviewed By: stroxler Differential Revision: D95282312 fbshipit-source-id: ba5b57d41986aa200e91355939f5f2b3752af7b8
1 parent 1105bc7 commit 79c9b38

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

conformance/third_party/conformance.exp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,7 +1752,7 @@
17521752
"description": "This `yield` expression is unreachable",
17531753
"line": 140,
17541754
"name": "unreachable",
1755-
"severity": "error",
1755+
"severity": "warn",
17561756
"stop_column": 13,
17571757
"stop_line": 140
17581758
},
@@ -1763,7 +1763,7 @@
17631763
"description": "This `yield` expression is unreachable",
17641764
"line": 145,
17651765
"name": "unreachable",
1766-
"severity": "error",
1766+
"severity": "warn",
17671767
"stop_column": 13,
17681768
"stop_line": 145
17691769
},
@@ -1774,7 +1774,7 @@
17741774
"description": "This `yield` expression is unreachable",
17751775
"line": 190,
17761776
"name": "unreachable",
1777-
"severity": "error",
1777+
"severity": "warn",
17781778
"stop_column": 10,
17791779
"stop_line": 190
17801780
}

crates/pyrefly_config/src/error_kind.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ impl ErrorKind {
344344
ErrorKind::UnannotatedParameter => Severity::Ignore,
345345
ErrorKind::UnannotatedReturn => Severity::Ignore,
346346
ErrorKind::UnnecessaryComparison => Severity::Warn,
347+
ErrorKind::Unreachable => Severity::Warn,
347348
ErrorKind::UnresolvableDunderAll => Severity::Warn,
348349
// TODO: up severity to Warn when https://github.com/facebook/pyrefly/issues/1950 is fixed
349350
ErrorKind::UntypedImport => Severity::Ignore,

website/docs/error-kinds.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,8 @@ def valid_generator():
13001300
yield 2 # This is valid
13011301
```
13021302

1303+
The default severity of this diagnostic is `warn`.
1304+
13031305
## unresolvable-dunder-all
13041306

13051307
Default severity: **warn**

0 commit comments

Comments
 (0)