Skip to content

Commit

Permalink
K1/K2: add tests for KT-65441 current behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
mglukhikh authored and qodana-bot committed Feb 27, 2024
1 parent 5885514 commit d870d9d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
// ISSUE: KT-64640
// ISSUE: KT-64640, KT-65441

fun bar(x: List<String>) {
x.<!UNRESOLVED_REFERENCE!>addFirst<!>("")
x.<!UNRESOLVED_REFERENCE!>addLast<!>("")
x.<!UNRESOLVED_REFERENCE!>removeFirst<!>()
x.<!UNRESOLVED_REFERENCE!>removeLast<!>()
x.<!UNRESOLVED_REFERENCE!>getFirst<!>()
x.<!UNRESOLVED_REFERENCE!>getLast<!>()
x.<!FUNCTION_CALL_EXPECTED!>first<!>
x.<!FUNCTION_CALL_EXPECTED!>last<!>
}

// Additional test for other SequenceCollection inheritor
Expand All @@ -13,11 +17,19 @@ fun baz(x: ArrayDeque<String>, y: LinkedHashSet<String>) {
x.addLast("")
x.removeFirst()
x.removeLast()
x.<!UNRESOLVED_REFERENCE!>getFirst<!>()
x.<!UNRESOLVED_REFERENCE!>getLast<!>()
x.<!FUNCTION_CALL_EXPECTED!>first<!>
x.<!FUNCTION_CALL_EXPECTED!>last<!>

y.addFirst("")
y.addLast("")
y.removeFirst()
y.removeLast()
y.getFirst()
y.getLast()
y.first
y.last
}

// Test for collections with (add/remove)(First/Last) methods which are not covered by autotests
Expand All @@ -26,14 +38,26 @@ fun foo(x: java.util.SequencedCollection<String>, y: java.util.SequencedSet<Stri
x.addLast("")
x.removeFirst()
x.removeLast()
x.getFirst()
x.getLast()
x.first
x.last

y.addFirst("")
y.addLast("")
y.removeFirst()
y.removeLast()
y.getFirst()
y.getLast()
y.first
y.last

z.addFirst("")
z.addLast("")
z.removeFirst()
z.removeLast()
z.getFirst()
z.getLast()
z.first
z.last
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
// ISSUE: KT-64640
// ISSUE: KT-64640, KT-65441

fun bar(x: List<String>) {
x.<!UNRESOLVED_REFERENCE!>addFirst<!>("")
x.<!UNRESOLVED_REFERENCE!>addLast<!>("")
x.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>removeFirst<!>()
x.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>removeLast<!>()
x.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>getFirst<!>()
x.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>getLast<!>()
x.<!DEPRECATION!>first<!>
x.<!DEPRECATION!>last<!>
}

// Additional test for other SequenceCollection inheritor
Expand All @@ -13,11 +17,19 @@ fun baz(x: ArrayDeque<String>, y: LinkedHashSet<String>) {
x.addLast("")
x.removeFirst()
x.removeLast()
x.<!DEPRECATION!>getFirst<!>()
x.<!DEPRECATION!>getLast<!>()
x.<!DEPRECATION!>first<!>
x.<!DEPRECATION!>last<!>

y.addFirst("")
y.addLast("")
y.removeFirst()
y.removeLast()
y.getFirst()
y.getLast()
y.first
y.last
}

// Test for collections with (add/remove)(First/Last) methods which are not covered by autotests
Expand All @@ -26,14 +38,26 @@ fun foo(x: java.util.SequencedCollection<String>, y: java.util.SequencedSet<Stri
x.addLast("")
x.removeFirst()
x.removeLast()
x.getFirst()
x.getLast()
x.first
x.last

y.addFirst("")
y.addLast("")
y.removeFirst()
y.removeLast()
y.getFirst()
y.getLast()
y.first
y.last

z.addFirst("")
z.addLast("")
z.removeFirst()
z.removeLast()
z.getFirst()
z.getLast()
z.first
z.last
}

0 comments on commit d870d9d

Please sign in to comment.