Binary and unary expression support
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE
|
||||
inline fun <T, U> Function1<T, U>.get(index : Int) {
|
||||
|
||||
}
|
||||
|
||||
inline fun <T, U, V> ExtensionFunction1<T, U, V>.get(index : Int) {
|
||||
|
||||
}
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T) -> U, ext: T.(p: U) -> V) {
|
||||
s[1]
|
||||
ext[1]
|
||||
}
|
||||
|
||||
//noinline
|
||||
fun <T, U, V> Function2<T, U, V>.get(index : Int) {
|
||||
|
||||
}
|
||||
|
||||
fun <T, U, V, W> ExtensionFunction2<T, U, V, W>.get(index : Int) {
|
||||
|
||||
}
|
||||
|
||||
inline fun <T, U, V, W> inlineFunWithInvoke(s: (p: T, l: U) -> V, ext: T.(p: U, l: V) -> W) {
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!>[1]
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!>[1]
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE
|
||||
|
||||
fun <T, U> Function1<T, U>.minusAssign(p: Function1<T, U>) {}
|
||||
|
||||
inline fun <T, U> Function1<T, U>.modAssign(p: Function1<T, U>) = {
|
||||
this += p
|
||||
p += this
|
||||
}
|
||||
|
||||
inline fun <T, U> Function1<T, U>.plusAssign(p: Function1<T, U>) {
|
||||
<!USAGE_IS_NOT_INLINABLE!>this<!> -= <!USAGE_IS_NOT_INLINABLE!>p<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>p<!> -= <!USAGE_IS_NOT_INLINABLE!>this<!>
|
||||
}
|
||||
|
||||
fun <T, U, V> ExtensionFunction1<T, U, V>.minusAssign(ext : ExtensionFunction1<T, U, V>) {}
|
||||
|
||||
inline fun <T, U, V> ExtensionFunction1<T, U, V>.modAssign(ext : ExtensionFunction1<T, U, V>) = {
|
||||
this += ext
|
||||
ext += this
|
||||
}
|
||||
|
||||
inline fun <T, U, V> ExtensionFunction1<T, U, V>.plusAssign(ext : ExtensionFunction1<T, U, V>) {
|
||||
<!USAGE_IS_NOT_INLINABLE!>this<!> -= <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!> -= <!USAGE_IS_NOT_INLINABLE!>this<!>
|
||||
}
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T) -> U, ext: T.(p: U) -> V) {
|
||||
s += s
|
||||
ext += ext
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE
|
||||
|
||||
inline fun <T, U> Function1<T, U>.compareTo(p: Function1<T, U>) = 1
|
||||
inline fun <T, U, V> ExtensionFunction1<T, U, V>.compareTo(index : ExtensionFunction1<T, U, V>) = 1
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T) -> U, ext: T.(p: U) -> V) {
|
||||
s < s
|
||||
s <= s
|
||||
s > s
|
||||
s >= s
|
||||
|
||||
ext < ext
|
||||
ext > ext
|
||||
ext <= ext
|
||||
ext >= ext
|
||||
}
|
||||
|
||||
//noinline
|
||||
fun <T, U, V> Function2<T, U, V>.compareTo(index : Function2<T, U, V>) = 1
|
||||
fun <T, U, V, W> ExtensionFunction2<T, U, V, W>.compareTo(index : ExtensionFunction2<T, U, V, W>) = 1
|
||||
|
||||
inline fun <T, U, V, W> inlineFunWithInvoke(s: (p: T, l: U) -> V, ext: T.(p: U, l: V) -> W) {
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!> < <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!> <= <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!> > <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!> >= <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!> < <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!> > <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!> <= <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!> >= <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE
|
||||
inline fun <T, U> Function1<T, U>.component1() = 1
|
||||
inline fun <T, U> Function1<T, U>.component2() = 2
|
||||
|
||||
inline fun <T, U, V> ExtensionFunction1<T, U, V>.component1() = 1
|
||||
inline fun <T, U, V> ExtensionFunction1<T, U, V>.component2() = 2
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T) -> U, ext: T.(p: U) -> V) {
|
||||
val (d1, e1) = s
|
||||
val (d2, e2) = ext
|
||||
}
|
||||
|
||||
fun <T, U, V> Function2<T, U, V>.component1() = 1
|
||||
fun <T, U, V> Function2<T, U, V>.component2() = 2
|
||||
|
||||
fun <T, U, V, W> ExtensionFunction2<T, U, V, W>.component1() = 1
|
||||
fun <T, U, V, W> ExtensionFunction2<T, U, V, W>.component2() = 2
|
||||
|
||||
inline fun <T, U, V, W> inlineFunWithInvoke(s: (p: T, l: U) -> V, ext: T.(p: U, l: V) -> W) {
|
||||
val (d1, e1) = <!USAGE_IS_NOT_INLINABLE, USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
val (d2, e2) = <!USAGE_IS_NOT_INLINABLE, USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE
|
||||
inline fun <T, U> Function1<T, U>.contains(p: Function1<T, U>): Boolean {
|
||||
this in p
|
||||
p in this
|
||||
return false
|
||||
}
|
||||
|
||||
inline fun <T, U, V> ExtensionFunction1<T, U, V>.contains(ext: ExtensionFunction1<T, U, V>): Boolean {
|
||||
ext in this
|
||||
this in ext
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T) -> U, ext: T.(p: U) -> V) {
|
||||
s in s
|
||||
s !in s
|
||||
|
||||
ext in ext
|
||||
ext !in ext
|
||||
}
|
||||
|
||||
|
||||
fun <T, U, V> Function2<T, U, V>.contains(p: Function2<T, U, V>): Boolean = false
|
||||
|
||||
fun <T, U, V, W> ExtensionFunction2<T, U, V, W>.contains(ext: ExtensionFunction2<T, U, V, W>): Boolean = false
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T, l: U) -> U, ext: T.(p: U, l: U) -> V) {
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!> in <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!> !in <!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!> in <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!> !in <!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE
|
||||
fun <T, U> Function1<T, U>.minus(p: Function1<T, U>) {
|
||||
|
||||
}
|
||||
|
||||
fun <T, U, V> ExtensionFunction1<T, U, V>.minus(p: T.(p: U) -> V) {
|
||||
|
||||
}
|
||||
|
||||
inline fun <T, U> Function1<T, U>.plus(p: Function1<T, U>) {
|
||||
<!USAGE_IS_NOT_INLINABLE!>this<!> - <!USAGE_IS_NOT_INLINABLE!>p<!>
|
||||
}
|
||||
|
||||
inline fun <T, U, V> ExtensionFunction1<T, U, V>.plus(p: T.(p: U) -> V) {
|
||||
<!USAGE_IS_NOT_INLINABLE!>this<!> - <!USAGE_IS_NOT_INLINABLE!>p<!>
|
||||
}
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T) -> U, ext: T.(p: U) -> V) {
|
||||
s + s
|
||||
ext + ext
|
||||
}
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T) -> U, ext: T.(p: U) -> V) {
|
||||
s + s
|
||||
ext + ext
|
||||
}
|
||||
|
||||
inline fun <T, U> Function1<T, U>.submit() {
|
||||
this + this
|
||||
}
|
||||
|
||||
inline fun <T, U, V> ExtensionFunction1<T, U, V>.submit() {
|
||||
this + this
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE
|
||||
|
||||
inline fun <T, U> Function1<T, U>.rangeTo(p: Function1<T, U>): Range<Int> {
|
||||
this..p
|
||||
p..this
|
||||
return 1..2
|
||||
}
|
||||
|
||||
inline fun <T, U, V> ExtensionFunction1<T, U, V>.rangeTo(ext: ExtensionFunction1<T, U, V>): Range<Int> {
|
||||
ext..this
|
||||
this..ext
|
||||
return 1..2
|
||||
}
|
||||
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T) -> U, ext: T.(p: U) -> V) {
|
||||
s..s
|
||||
s..s
|
||||
|
||||
ext..ext
|
||||
ext..ext
|
||||
}
|
||||
|
||||
|
||||
fun <T, U, V> Function2<T, U, V>.rangeTo(p: Function2<T, U, V>): Range<Int> {
|
||||
return 1..2
|
||||
}
|
||||
|
||||
fun <T, U, V, W> ExtensionFunction2<T, U, V, W>.rangeTo(ext: ExtensionFunction2<T, U, V, W>): Range<Int> {
|
||||
return 1..2
|
||||
}
|
||||
|
||||
inline fun <T, U, V> inlineFunWithInvoke(s: (p: T, l: U) -> U, ext: T.(p: U, l: U) -> V) {
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!>..<!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>s<!>..<!USAGE_IS_NOT_INLINABLE!>s<!>
|
||||
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!>..<!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
<!USAGE_IS_NOT_INLINABLE!>ext<!>..<!USAGE_IS_NOT_INLINABLE!>ext<!>
|
||||
}
|
||||
Reference in New Issue
Block a user