2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/expr.ts (69 errors) ====
|
|
|
|
interface I {
|
|
|
|
}
|
|
|
|
|
|
|
|
enum E {
|
|
|
|
Red, Green, Blue
|
|
|
|
}
|
|
|
|
|
|
|
|
function f() {
|
|
|
|
var a;
|
|
|
|
var n=3;
|
|
|
|
var s="";
|
|
|
|
var b=false;
|
|
|
|
var i:I;
|
|
|
|
var e:E;
|
|
|
|
|
|
|
|
n&&a;
|
|
|
|
n&&s;
|
|
|
|
n&&b;
|
|
|
|
n&&i;
|
|
|
|
n&&n;
|
|
|
|
n&&e;
|
|
|
|
|
|
|
|
s&&a;
|
|
|
|
s&&n;
|
|
|
|
s&&b;
|
|
|
|
s&&i;
|
|
|
|
s&&s;
|
|
|
|
s&&e;
|
|
|
|
|
|
|
|
a&&n;
|
|
|
|
a&&s;
|
|
|
|
a&&b;
|
|
|
|
a&&i;
|
|
|
|
a&&a;
|
|
|
|
a&&e;
|
|
|
|
|
|
|
|
i&&n;
|
|
|
|
i&&s;
|
|
|
|
i&&b;
|
|
|
|
i&&a;
|
|
|
|
i&&i;
|
|
|
|
i&&e;
|
|
|
|
|
|
|
|
e&&n;
|
|
|
|
e&&s;
|
|
|
|
e&&b;
|
|
|
|
e&&a;
|
|
|
|
e&&i;
|
|
|
|
e&&e;
|
|
|
|
|
|
|
|
n||a;
|
|
|
|
n||s;
|
|
|
|
n||b;
|
|
|
|
n||i;
|
|
|
|
n||n;
|
|
|
|
n||e;
|
|
|
|
|
|
|
|
s||a;
|
|
|
|
s||n;
|
|
|
|
s||b;
|
|
|
|
s||i;
|
|
|
|
s||s;
|
|
|
|
s||e;
|
|
|
|
|
|
|
|
a||n;
|
|
|
|
a||s;
|
|
|
|
a||b;
|
|
|
|
a||i;
|
|
|
|
a||a;
|
|
|
|
a||e;
|
|
|
|
|
|
|
|
i||n;
|
|
|
|
i||s;
|
|
|
|
i||b;
|
|
|
|
i||a;
|
|
|
|
i||i;
|
|
|
|
i||e;
|
|
|
|
|
|
|
|
e||n;
|
|
|
|
e||s;
|
|
|
|
e||b;
|
|
|
|
e||a;
|
|
|
|
e||i;
|
|
|
|
e||e;
|
|
|
|
|
|
|
|
n==a;
|
|
|
|
n==s;
|
|
|
|
~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '==' cannot be applied to types 'number' and 'string'.
|
2014-07-13 01:04:16 +02:00
|
|
|
n==b;
|
|
|
|
~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '==' cannot be applied to types 'number' and 'boolean'.
|
2014-07-13 01:04:16 +02:00
|
|
|
n==i;
|
|
|
|
n==n;
|
|
|
|
n==e;
|
|
|
|
|
|
|
|
s==a;
|
|
|
|
s==n;
|
|
|
|
~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '==' cannot be applied to types 'string' and 'number'.
|
2014-07-13 01:04:16 +02:00
|
|
|
s==b;
|
|
|
|
~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '==' cannot be applied to types 'string' and 'boolean'.
|
2014-07-13 01:04:16 +02:00
|
|
|
s==i;
|
|
|
|
s==s;
|
|
|
|
s==e;
|
|
|
|
~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '==' cannot be applied to types 'string' and 'E'.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
a==n;
|
|
|
|
a==s;
|
|
|
|
a==b;
|
|
|
|
a==i;
|
|
|
|
a==a;
|
|
|
|
a==e;
|
|
|
|
|
|
|
|
i==n;
|
|
|
|
i==s;
|
|
|
|
i==b;
|
|
|
|
i==a;
|
|
|
|
i==i;
|
|
|
|
i==e;
|
|
|
|
|
|
|
|
e==n;
|
|
|
|
e==s;
|
|
|
|
~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '==' cannot be applied to types 'E' and 'string'.
|
2014-07-13 01:04:16 +02:00
|
|
|
e==b;
|
|
|
|
~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '==' cannot be applied to types 'E' and 'boolean'.
|
2014-07-13 01:04:16 +02:00
|
|
|
e==a;
|
|
|
|
e==i;
|
|
|
|
e==e;
|
|
|
|
|
|
|
|
+i;
|
|
|
|
+s;
|
|
|
|
+n;
|
|
|
|
+a;
|
|
|
|
+b;
|
|
|
|
|
|
|
|
-i;
|
|
|
|
-s;
|
|
|
|
-n;
|
|
|
|
-a;
|
|
|
|
-b;
|
|
|
|
|
|
|
|
!i;
|
|
|
|
!s;
|
|
|
|
!n;
|
|
|
|
!a;
|
|
|
|
!b;
|
|
|
|
|
|
|
|
|
|
|
|
n+a;
|
|
|
|
n+s;
|
|
|
|
n+b;
|
|
|
|
~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'.
|
2014-07-13 01:04:16 +02:00
|
|
|
n+i;
|
|
|
|
~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'I'.
|
2014-07-13 01:04:16 +02:00
|
|
|
n+n;
|
|
|
|
n+e;
|
|
|
|
|
|
|
|
s+a;
|
|
|
|
s+n;
|
|
|
|
s+b;
|
|
|
|
s+i;
|
|
|
|
s+s;
|
|
|
|
s+e;
|
|
|
|
|
|
|
|
a+n;
|
|
|
|
a+s;
|
|
|
|
a+b;
|
|
|
|
a+i;
|
|
|
|
a+a;
|
|
|
|
a+e;
|
|
|
|
|
|
|
|
i+n;
|
|
|
|
~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'I' and 'number'.
|
2014-07-13 01:04:16 +02:00
|
|
|
i+s;
|
|
|
|
i+b;
|
|
|
|
~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'I' and 'boolean'.
|
2014-07-13 01:04:16 +02:00
|
|
|
i+a;
|
|
|
|
i+i;
|
|
|
|
~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'I' and 'I'.
|
2014-07-13 01:04:16 +02:00
|
|
|
i+e;
|
|
|
|
~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'I' and 'E'.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
e+n;
|
|
|
|
e+s;
|
|
|
|
e+b;
|
|
|
|
~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'boolean'.
|
2014-07-13 01:04:16 +02:00
|
|
|
e+a;
|
|
|
|
e+i;
|
|
|
|
~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'I'.
|
2014-07-13 01:04:16 +02:00
|
|
|
e+e;
|
|
|
|
|
|
|
|
n^a;
|
|
|
|
n^s;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
n^b;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
n^i;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
n^n;
|
|
|
|
n^e;
|
|
|
|
|
|
|
|
s^a;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
s^n;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
s^b;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
s^i;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
s^s;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
s^e;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
a^n;
|
|
|
|
a^s;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
a^b;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
a^i;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
a^a;
|
|
|
|
a^e;
|
|
|
|
|
|
|
|
i^n;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
i^s;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
i^b;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
i^a;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
i^i;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
i^e;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
e^n;
|
|
|
|
e^s;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
e^b;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
e^a;
|
|
|
|
e^i;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
e^e;
|
|
|
|
|
|
|
|
n-a;
|
|
|
|
n-s;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
n-b;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
n-i;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
n-n;
|
|
|
|
n-e;
|
|
|
|
|
|
|
|
s-a;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
s-n;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
s-b;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
s-i;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
s-s;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
s-e;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
a-n;
|
|
|
|
a-s;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
a-b;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
a-i;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
a-a;
|
|
|
|
a-e;
|
|
|
|
|
|
|
|
i-n;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
i-s;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
i-b;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
i-a;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
i-i;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
i-e;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
e-n;
|
|
|
|
e-s;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
e-b;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
e-a;
|
|
|
|
e-i;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
2014-07-13 01:04:16 +02:00
|
|
|
e-e;
|
|
|
|
|
|
|
|
}
|