     var swiftReturnRef: TypeReference {
         guard var replacement = GIR.swiftReturnTypeReplacements[typeRef] else { return typeRef }
         replacement.isConst = typeRef.isConst
+        replacement.isOptional = typeRef.isOptional
         return replacement
     }
 

    var swiftParamRef: TypeReference {
        guard var replacement = GIR.swiftParameterTypeReplacements[typeRef] else { return typeRef }
        replacement.isConst = typeRef.isConst
        return replacement
    }


    @inlinable func returnTypeName(for record: GIR.Record? = nil, beingIdiomatic: Bool = true) -> String {
        let idiomaticName = idiomaticWrappedTypeName
        let name = beingIdiomatic && !idiomaticName.isEmpty ? idiomaticName : typeRef.fullSwiftTypeName
        if (typeRef.isOptional || maybeOptional(for: record)) && !name.hasSuffix("?") && !name.hasSuffix("!") {
            return name + "!"
        } else {
            return name
