Commit 47663bd
Normalize indices in promote_shape error messages (#41311)
Seeing implementation details like `Base.OneTo` in error messages may
be confusing to some users (cf discussion in #39242,
[discourse](https://discourse.julialang.org/t/promote-shape-dimension-mismatch/57529/)).
This PR turns
```julia
julia> ones(2, 3) + ones(3, 2)
ERROR: DimensionMismatch("dimensions must match: a has dims (Base.OneTo(2), Base.OneTo(3)), b has dims (Base.OneTo(3), Base.OneTo(2)), mismatch at 1")
```
into
```julia
julia> ones(2, 3) + ones(3, 2)
ERROR: DimensionMismatch("dimensions must match: a has size (2, 3), b has size (3, 2), mismatch at 1")
```
Fixes #40118.
(This is basically #40124, but redone because I made a mess rebasing).
---------
Co-authored-by: Jameson Nash <[email protected]>1 parent 831cc14 commit 47663bd
File tree
4 files changed
+46
-24
lines changed- base
- stdlib/LinearAlgebra
- src
- test
4 files changed
+46
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
111 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
112 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
113 | 140 | | |
114 | 141 | | |
115 | 142 | | |
116 | 143 | | |
117 | | - | |
118 | | - | |
119 | | - | |
| 144 | + | |
120 | 145 | | |
121 | 146 | | |
122 | 147 | | |
123 | 148 | | |
124 | 149 | | |
125 | 150 | | |
126 | | - | |
127 | | - | |
128 | | - | |
| 151 | + | |
129 | 152 | | |
130 | 153 | | |
131 | 154 | | |
| |||
153 | 176 | | |
154 | 177 | | |
155 | 178 | | |
156 | | - | |
157 | | - | |
158 | | - | |
| 179 | + | |
159 | 180 | | |
160 | 181 | | |
161 | | - | |
162 | | - | |
163 | | - | |
| 182 | + | |
164 | 183 | | |
165 | 184 | | |
166 | 185 | | |
| |||
174 | 193 | | |
175 | 194 | | |
176 | 195 | | |
177 | | - | |
178 | | - | |
179 | | - | |
| 196 | + | |
180 | 197 | | |
181 | 198 | | |
182 | | - | |
183 | | - | |
184 | | - | |
| 199 | + | |
185 | 200 | | |
186 | 201 | | |
187 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
| 200 | + | |
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
255 | 257 | | |
256 | 258 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
145 | 150 | | |
146 | 151 | | |
147 | 152 | | |
| |||
0 commit comments