Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Commit17271e5
Fix narrowing on match with function subject (#16503)
Fixes#12998mypy can't narrow match statements with functions subjects because thecallexpr node is not a literal node. This adds a 'dummy' literal nodethat the match statement visitor can use to do the type narrowing.The python grammar describes the the match subject as a named expressionso this uses that nameexpr node as it's literal.---------Co-authored-by: hauntsaninja <hauntsaninja@gmail.com>1 parentbfbac5e commit17271e5
2 files changed
+31
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5053 | 5053 | | |
5054 | 5054 | | |
5055 | 5055 | | |
| 5056 | + | |
| 5057 | + | |
| 5058 | + | |
| 5059 | + | |
| 5060 | + | |
| 5061 | + | |
| 5062 | + | |
| 5063 | + | |
| 5064 | + | |
| 5065 | + | |
| 5066 | + | |
| 5067 | + | |
| 5068 | + | |
5056 | 5069 | | |
5057 | 5070 | | |
5058 | 5071 | | |
| |||
5071 | 5084 | | |
5072 | 5085 | | |
5073 | 5086 | | |
5074 | | - | |
| 5087 | + | |
5075 | 5088 | | |
5076 | 5089 | | |
5077 | 5090 | | |
| |||
5082 | 5095 | | |
5083 | 5096 | | |
5084 | 5097 | | |
5085 | | - | |
| 5098 | + | |
5086 | 5099 | | |
5087 | 5100 | | |
5088 | 5101 | | |
| |||
5110 | 5123 | | |
5111 | 5124 | | |
5112 | 5125 | | |
5113 | | - | |
| 5126 | + | |
5114 | 5127 | | |
5115 | 5128 | | |
5116 | 5129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1139 | 1139 | | |
1140 | 1140 | | |
1141 | 1141 | | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
1142 | 1157 | | |
1143 | 1158 | | |
1144 | 1159 | | |
| |||
0 commit comments
Comments
(0)