Question: I'm working on extension method like this:

```
infix fun <T> T.isNullOr(other: T): Boolean {
    if (this == null) return true
    return this == other
}

```

and I'm trying to use this method like this.

```
val thisShouldWork = true isNullOr true // this is true
val thisShouldNotWork = true isNullOr 0 // No compilation errors?

```

I expected compilation error because type parameter is automatically set to `Boolean` for `isNullOr` but it wasn't. What's happening?

am I misunderstanding about it?

in C#, same code working well as I expected.

```cs
static bool IsNullOr<T>(this T t, T other) {
    if (t == null) return true;
    return Equals(t, other);
}

bool howAboutThis = 0.IsNullOr(0);
bool andThis = 0.IsNullOr(false); // error - cannot detect type parameter for this

```

Answer: 
Here, `val thisShouldNotWork = true isNullOr 0` is equal to `val thisShouldNotWork: Boolean = true.isNullOr<Any>(0)`. Type parameter as inferred as the closest parent. 

And function's return type is based on **logical expression evaluation**: `this == other`. Let's see `==` function declaration: `public open operator fun equals(other: Any?): Boolean`. It receives `Any?`.

Type parameter in this function has nothing to do with `Boolean`.
Thank for answers. I think there is no way to prevent this at compilation level, so I decided to check type for `other`.

```
inline infix fun <reified T> T.isNullOr(other: T): Boolean {
    if (this == null) return true
    if (other !is T) return false
    return this == other
}

```