Skip to content

Commit c6b6d4e

Browse files
authored
Properly resolve optional type erasers (#1561)
1 parent 521afe2 commit c6b6d4e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/SwiftSyntaxExtensions/ValueResolution.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ public extension FunctionParameterSyntax {
117117
// value.resolve(on: __element, in: __context)
118118
var resolvedAttribute = FunctionCallExprSyntax.resolveAttributeReference(parameterReference)
119119
// a resolvable value should call `resolve(...)` again
120-
if attributeReferenceType.genericArgumentClause!.arguments.first!.argument.as(IdentifierTypeSyntax.self)?.name.text.starts(with: "StylesheetResolvable") ?? false {
120+
if attributeReferenceType.genericArgumentClause!.arguments.first!.argument.as(IdentifierTypeSyntax.self)?.name.text.starts(with: "StylesheetResolvable")
121+
?? attributeReferenceType.genericArgumentClause!.arguments.first!.argument.as(OptionalTypeSyntax.self)?.wrappedType.as(IdentifierTypeSyntax.self)?.name.text.starts(with: "StylesheetResolvable")
122+
?? false
123+
{
121124
resolvedAttribute = FunctionCallExprSyntax.resolveAttributeReference(resolvedAttribute)
122125
}
123126
// InlineViewReference should call `resolve(...)` again

0 commit comments

Comments
 (0)