File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,15 @@ function subst_trivial_bounds(@nospecialize(atypes))
156
156
end
157
157
v = atypes. var
158
158
if isconcretetype (v. ub) || v. lb === v. ub
159
- return subst_trivial_bounds (atypes{v. ub})
159
+ subst = try
160
+ atypes{v. ub}
161
+ catch
162
+ # Note in rare cases a var bound might not be valid to substitute.
163
+ nothing
164
+ end
165
+ if subst != = nothing
166
+ return subst_trivial_bounds (subst)
167
+ end
160
168
end
161
169
return UnionAll (v, subst_trivial_bounds (atypes. body))
162
170
end
Original file line number Diff line number Diff line change @@ -3408,3 +3408,8 @@ end
3408
3408
@test @inferred (f40177 (T)) == fieldtype (T, 1 )
3409
3409
end
3410
3410
end
3411
+
3412
+ # issue #41908
3413
+ f41908 (x:: Complex{T} ) where {String<: T <: String } = 1
3414
+ g41908 () = f41908 (Any[1 ][1 ])
3415
+ @test only (Base. return_types (g41908, ())) <: Int
You can’t perform that action at this time.
0 commit comments