Skip to content

Commit

Permalink
Use Full Generic
Browse files Browse the repository at this point in the history
  • Loading branch information
jrosen081 committed Jan 12, 2024
1 parent 018dbec commit 7b7ba55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Sources/WhoopDIKitMacros/InjectableMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import SwiftSyntaxMacroExpansion

private struct VariableDeclaration {
let name: String
let type: String
let type: IdentifierTypeSyntax
let defaultExpression: ExprSyntax?
let injectedName: String?
}
Expand Down Expand Up @@ -199,7 +199,7 @@ extension VariableDeclSyntax {
self.bindings.first?.pattern.as(IdentifierPatternSyntax.self)?.identifier.text
}

var typeName: String? {
self.bindings.first?.typeAnnotation?.type.as(IdentifierTypeSyntax.self)?.name.text
var typeName: IdentifierTypeSyntax? {
self.bindings.first?.typeAnnotation?.type.as(IdentifierTypeSyntax.self)?.trimmed
}
}
6 changes: 3 additions & 3 deletions Tests/WhoopDIKitTests/InjectableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class InjectableTests: XCTestCase {
public static var staticProp: String = "no"
let id: String = "no"
var newerThing: String { "not again" }
let bestThing: Int
let bestThing: Int<String> // This type is not real, but is useful for generics
lazy var lazyVar: Double = 100
}
""",
Expand All @@ -55,14 +55,14 @@ final class InjectableTests: XCTestCase {
public static var staticProp: String = "no"
let id: String = "no"
var newerThing: String { "not again" }
let bestThing: Int
let bestThing: Int<String> // This type is not real, but is useful for generics
lazy var lazyVar: Double = 100
public static func inject() -> Self {
Self.init(bestThing: WhoopDI.inject(nil))
}
public init(bestThing: Int) {
public init(bestThing: Int<String>) {
self.bestThing = bestThing
}
}
Expand Down

0 comments on commit 7b7ba55

Please sign in to comment.