Skip to content

Commit

Permalink
Removed protocol composition due to Swift compiler crash under Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
art-divin committed Jun 19, 2024
1 parent 404e50d commit 56c7c16
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 30 deletions.
5 changes: 0 additions & 5 deletions Templates/Tests/Context/AutoMockable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ protocol TestProtocol {

func getValue() -> Value


associatedtype Value2 = Int

func getValue2() -> Value2
Expand All @@ -285,10 +284,6 @@ protocol TestProtocol {

func getValue3() -> Value3

associatedtype Value4: Sequence & Hashable

func getValue4() -> Value4

associatedtype Value5: Sequence where Value5.Element == Int

func getValue5() -> Value5
Expand Down
5 changes: 0 additions & 5 deletions Templates/Tests/Context_Linux/AutoMockable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ protocol TestProtocol {

func getValue() -> Value


associatedtype Value2 = Int

func getValue2() -> Value2
Expand All @@ -285,10 +284,6 @@ protocol TestProtocol {

func getValue3() -> Value3

associatedtype Value4: Sequence & Hashable

func getValue4() -> Value4

associatedtype Value5: Sequence where Value5.Element == Int

func getValue5() -> Value5
Expand Down
19 changes: 0 additions & 19 deletions Templates/Tests/Expected/AutoMockable.expected
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,6 @@ class SubscriptProtocolMock: SubscriptProtocol {
class TestProtocolMock<
Value: Sequence,
Value3: Collection,
Value4: Sequence & Hashable,
Value5: Sequence,
Value6: Sequence>: TestProtocol
where Value.Element : Collection,Value.Element : Hashable,Value.Element : Comparable,Value3.Element == String,Value5.Element == Int,Value6.Element == Int,Value6.Element : Hashable,Value6.Element : Comparable {
Expand Down Expand Up @@ -1712,24 +1711,6 @@ class TestProtocolMock<
}
}

//MARK: - getValue4

var getValue4TestProtocolCallsCount = 0
var getValue4TestProtocolCalled: Bool {
return getValue4TestProtocolCallsCount > 0
}
var getValue4TestProtocolReturnValue: Value4!
var getValue4TestProtocolClosure: (() -> Value4)?

func getValue4() -> Value4 {
getValue4TestProtocolCallsCount += 1
if let getValue4TestProtocolClosure = getValue4TestProtocolClosure {
return getValue4TestProtocolClosure()
} else {
return getValue4TestProtocolReturnValue
}
}

//MARK: - getValue5

var getValue5SequenceCallsCount = 0
Expand Down
106 changes: 105 additions & 1 deletion Templates/Tests/Generated/AutoMockable.generated.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated using Sourcery 2.1.7 — https://github.com/krzysztofzablocki/Sourcery
// Generated using Sourcery 2.2.4 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT
// swiftlint:disable line_length
// swiftlint:disable variable_name
Expand Down Expand Up @@ -31,6 +31,7 @@ import AppKit






public class AccessLevelProtocolMock: AccessLevelProtocol {
Expand Down Expand Up @@ -1644,6 +1645,109 @@ class SubscriptProtocolMock: SubscriptProtocol {
subscript<T>(arg: String) -> T? where T : Cancellable {
get throws { fatalError("Subscripts are not fully supported yet") }
}
}
class TestProtocolMock<
Value: Sequence,
Value3: Collection,
Value5: Sequence,
Value6: Sequence>: TestProtocol
where Value.Element : Collection,Value.Element : Hashable,Value.Element : Comparable,Value3.Element == String,Value5.Element == Int,Value6.Element == Int,Value6.Element : Hashable,Value6.Element : Comparable {
typealias Value2 = Int




//MARK: - getValue

var getValueSequenceCallsCount = 0
var getValueSequenceCalled: Bool {
return getValueSequenceCallsCount > 0
}
var getValueSequenceReturnValue: Value!
var getValueSequenceClosure: (() -> Value)?

func getValue() -> Value {
getValueSequenceCallsCount += 1
if let getValueSequenceClosure = getValueSequenceClosure {
return getValueSequenceClosure()
} else {
return getValueSequenceReturnValue
}
}

//MARK: - getValue2

var getValue2Value2CallsCount = 0
var getValue2Value2Called: Bool {
return getValue2Value2CallsCount > 0
}
var getValue2Value2ReturnValue: Value2!
var getValue2Value2Closure: (() -> Value2)?

func getValue2() -> Value2 {
getValue2Value2CallsCount += 1
if let getValue2Value2Closure = getValue2Value2Closure {
return getValue2Value2Closure()
} else {
return getValue2Value2ReturnValue
}
}

//MARK: - getValue3

var getValue3CollectionCallsCount = 0
var getValue3CollectionCalled: Bool {
return getValue3CollectionCallsCount > 0
}
var getValue3CollectionReturnValue: Value3!
var getValue3CollectionClosure: (() -> Value3)?

func getValue3() -> Value3 {
getValue3CollectionCallsCount += 1
if let getValue3CollectionClosure = getValue3CollectionClosure {
return getValue3CollectionClosure()
} else {
return getValue3CollectionReturnValue
}
}

//MARK: - getValue5

var getValue5SequenceCallsCount = 0
var getValue5SequenceCalled: Bool {
return getValue5SequenceCallsCount > 0
}
var getValue5SequenceReturnValue: Value5!
var getValue5SequenceClosure: (() -> Value5)?

func getValue5() -> Value5 {
getValue5SequenceCallsCount += 1
if let getValue5SequenceClosure = getValue5SequenceClosure {
return getValue5SequenceClosure()
} else {
return getValue5SequenceReturnValue
}
}

//MARK: - getValue6

var getValue6SequenceCallsCount = 0
var getValue6SequenceCalled: Bool {
return getValue6SequenceCallsCount > 0
}
var getValue6SequenceReturnValue: Value6!
var getValue6SequenceClosure: (() -> Value6)?

func getValue6() -> Value6 {
getValue6SequenceCallsCount += 1
if let getValue6SequenceClosure = getValue6SequenceClosure {
return getValue6SequenceClosure()
} else {
return getValue6SequenceReturnValue
}
}


}
class ThrowableProtocolMock: ThrowableProtocol {

Expand Down

0 comments on commit 56c7c16

Please sign in to comment.