Commit 31a430b
committed
Sema: Tweak assertion in CustomAttrTypeRequest to allow generic typealiases
If the typealias here is generic, we return an UnboundGenericType
where getAnyNominal() returns nullptr. This would fail by returning
an ErrorType to the caller without diagnosing anything.
This was a regression after some recent refactoring to remove code
duplication and some TypeLoc usages, because one of the copies of
this code did not have this check, so it happened to work for
property wrappers.
Relax the check by looking through a TypeAliasDecl explicitly.
I believe we can't end up here anyway, because if the type was
not a nominal we would fail earlier in CustomAttrNominalRequest, and
we wouldn't attempt to compute the type of the property wrapper at
all. However it's better to keep the assertion in place just in case.
Fixes https://bugs.swift.org/browse/SR-14143 / rdar://problem/73888684.1 parent 927a2b3 commit 31a430b
File tree
3 files changed
+56
-3
lines changed- lib/Sema
- test/decl/var
3 files changed
+56
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3970 | 3970 | | |
3971 | 3971 | | |
3972 | 3972 | | |
3973 | | - | |
3974 | 3973 | | |
3975 | 3974 | | |
3976 | 3975 | | |
3977 | | - | |
3978 | | - | |
| 3976 | + | |
| 3977 | + | |
| 3978 | + | |
| 3979 | + | |
| 3980 | + | |
| 3981 | + | |
| 3982 | + | |
| 3983 | + | |
| 3984 | + | |
| 3985 | + | |
| 3986 | + | |
| 3987 | + | |
| 3988 | + | |
| 3989 | + | |
| 3990 | + | |
| 3991 | + | |
| 3992 | + | |
3979 | 3993 | | |
3980 | 3994 | | |
3981 | 3995 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
0 commit comments