tcltest::test 15.20.2-type-1 { The left side may be null } {
    empty_main T15202t1 {
	boolean b = null instanceof Object; // always false, but valid
    }
} PASS

tcltest::test 15.20.2-type-2 { The left side may be null } {
    empty_main T15202t2 {
	boolean b = null instanceof Runnable;
    }
} PASS

tcltest::test 15.20.2-type-3 { The left side may be null } {
    empty_main T15202t3 {
	boolean b = null instanceof int[];
    }
} PASS

tcltest::test 15.20.2-type-4 { The left side may not be primitive } {
    empty_main T15202t4 {
	boolean b = true instanceof Boolean;
    }
} FAIL

tcltest::test 15.20.2-type-5 { The left side may not be primitive } {
    empty_main T15202t5 {
	boolean b = true instanceof boolean;
    }
} FAIL

tcltest::test 15.20.2-type-6 { The left side may not be primitive } {
    empty_main T15202t6 {
	boolean b = 1 instanceof Integer;
    }
} FAIL

tcltest::test 15.20.2-type-7 { The left side may not be primitive } {
    empty_main T15202t7 {
	boolean b = 1 instanceof int;
    }
} FAIL

tcltest::test 15.20.2-type-8 { The left side may not be primitive } {
    empty_main T15202t8 {
	boolean b = '1' instanceof Character;
    }
} FAIL

tcltest::test 15.20.2-type-9 { The left side may not be primitive } {
    empty_main T15202t9 {
	boolean b = '1' instanceof char;
    }
} FAIL

tcltest::test 15.20.2-type-10 { The left side may not be primitive } {
    empty_main T15202t10 {
	boolean b = 1.0 instanceof Double;
    }
} FAIL

tcltest::test 15.20.2-type-11 { The left side may not be primitive } {
    empty_main T15202t11 {
	boolean b = 1.0 instanceof double;
    }
} FAIL

tcltest::test 15.20.2-type-12 { The left side may not be void } {
    empty_class T15202t12 {
	void m() {}
	boolean b = m() instanceof Object;
    }
} FAIL

tcltest::test 15.20.2-type-13 { The left side may not be void } {
    empty_class T15202t13 {
	void m() {}
	boolean b = m() instanceof void;
    }
} FAIL

tcltest::test 15.20.2-type-14 { The left side may be a class literal } {
    empty_main T15202t14 {
	boolean b = Object.class instanceof Class;
    }
} PASS

tcltest::test 15.20.2-type-15 { The left side may be a string literal } {
    empty_main T15202t15 {
	boolean b = "" instanceof String;
    }
} PASS

tcltest::test 15.20.2-type-16 { The left side may not be a type } {
    empty_main T15202t16 {
	boolean b = String instanceof Object;
    }
} FAIL

tcltest::test 15.20.2-type-17 { The right side must be a reference type } {
    empty_main T15202t17 {
	boolean b = null instanceof null;
    }
} FAIL

tcltest::test 15.20.2-type-18 { The right side must be a reference type } {
    empty_main T15202t18 {
	boolean b = new Integer() instanceof int;
    }
} FAIL

tcltest::test 15.20-2-always-1 { Always true (but expression is still
        evaluated) } {
    empty_main T15202a1 {
	// identity conversion of non-null
	boolean b = new Object() instanceof Object;
    }
} PASS

tcltest::test 15.20-2-always-2 { Always true (but expression is still
        evaluated) } {
    empty_main T15202a2 {
	// non-null subclass to superclass
	boolean b = new String() instanceof Object;
    }
} PASS

tcltest::test 15.20-2-always-3 { Always true (but expression is still
        evaluated) } {
    empty_main T15202a3 {
	// non-null array to Object
	boolean b = new int[1] instanceof Object;
    }
} PASS

tcltest::test 15.20-2-always-4 { Always true (but expression is still
        evaluated) } {
    empty_main T15202a4 {
	// non-null array to compatible array
	boolean b = new String[] {} instanceof String[];
    }
} PASS

tcltest::test 15.20-2-always-5 { Always true (but expression is still
        evaluated) } {
    empty_main T15202a5 {
	// non-null array to compatible array
	boolean b = new Integer[] {} instanceof Comparable[];
    }
} PASS

tcltest::test 15.20-2-always-6 { Always true (but expression is still
        evaluated) } {
    empty_main T15202a6 {
	// non-null array to Cloneable
	boolean b = new int[1] instanceof Cloneable;
    }
} PASS

tcltest::test 15.20-2-always-7 { Always true (but expression is still
        evaluated) } {
    empty_main T15202a7 {
	// non-null array to Serializable
	boolean b = new int[] {} instanceof java.io.Serializable;
    }
} PASS

tcltest::test 15.20-2-always-8 { Always true (but expression is still
        evaluated) } {
    empty_main T15202a8 {
	// non-null instance to superinterface
	boolean b = new Cloneable() {} instanceof Cloneable;
    }
} PASS

tcltest::test 15.20-2-sometimes-1 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_main T15202s1 {
	Object o = new Object();
	// identity
	boolean b = o instanceof Object;
    }
} PASS

tcltest::test 15.20-2-sometimes-2 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_main T15202s2 {
	Object o = "";
	// narrowing
	boolean b = o instanceof Integer; // false at runtime
    }
} PASS

tcltest::test 15.20-2-sometimes-3 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_main T15202s3 {
	String s = "";
	// widening
	boolean b = s instanceof Object;
    }
} PASS

tcltest::test 15.20-2-sometimes-4 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_main T15202s4 {
	Object o = "";
	// narrowing to interface
	boolean b = o instanceof Cloneable;
    }
} PASS

tcltest::test 15.20-2-sometimes-5 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_main T15202s5 {
	Object o = "";
	// narrowing to array
	boolean b = o instanceof int[];
    }
} PASS

tcltest::test 15.20-2-sometimes-6 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_main T15202s6 {
	Comparable c = "";
	// widening to Object
	boolean b = c instanceof Object;
    }
} PASS

tcltest::test 15.20-2-sometimes-7 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_class T15202s7 {
	interface I extends Cloneable {}
	I i = new I() {};
	// widening to superinterface
	boolean b = i instanceof Cloneable;
    }
} PASS

tcltest::test 15.20-2-sometimes-8 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_class T15202s8 {
	interface I extends Cloneable {}
	Cloneable c = new Cloneable() {};
	// narrowing to subinterface
	boolean b = c instanceof I;
    }
} PASS

tcltest::test 15.20-2-sometimes-9 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_class T15202s9 {
	Cloneable c = new Cloneable() {};
	// narrowing to array
	boolean b = c instanceof int[];
    }
} PASS

tcltest::test 15.20-2-sometimes-10 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_class T15202s10 {
	interface I {}
	Cloneable c = new Cloneable() {};
	// narrowing to compatible interface
	boolean b = c instanceof I;
    }
} PASS

tcltest::test 15.20-2-sometimes-11 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_class T15202s11 {
	int[] i = {};
	// widening to interface
	boolean b = i instanceof Cloneable;
    }
} PASS

tcltest::test 15.20-2-sometimes-12 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_class T15202s12 {
	String[] s = {};
	// widening to compatible array
	boolean b = s instanceof Object[];
    }
} PASS

tcltest::test 15.20-2-sometimes-13 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_class T15202s13 {
	String[] s = {};
	// widening to compatible array
	boolean b = s instanceof Comparable[];
    }
} PASS

tcltest::test 15.20-2-sometimes-14 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_class T15202s14 {
	Object[] o = {};
	// narrowing to compatible array
	boolean b = o instanceof Integer[];
    }
} PASS

tcltest::test 15.20-2-sometimes-15 { Sometimes true - requires runtime check
        that reference is non-null and compatible } {
    empty_class T15202s15 {
	Object[] o = {};
	// narrowing to compatible array
	boolean b = o instanceof Comparable[];
    }
} PASS

tcltest::test 15.20-2-never-1 { Compile-time error - not cast-compatible } {
    empty_main T15202n1 {
	boolean b = "" instanceof Integer;
    }
} FAIL

tcltest::test 15.20-2-never-2 { Compile-time error - not cast-compatible } {
    empty_main T15202n2 {
	boolean b = "" instanceof int[];
    }
} FAIL

tcltest::test 15.20-2-never-3 { Compile-time error - not cast-compatible } {
    empty_main T15202n3 {
	boolean b = new String[1] instanceof int[];
    }
} FAIL

tcltest::test 15.20-2-never-4 { Compile-time error - not cast-compatible } {
    empty_class T15202n4 {
	interface I { void m(); }
	interface J { int m(); }
	boolean n(I i) {
	    return i instanceof J;
	}
    }
} FAIL

tcltest::test 15.20-2-never-5 { Compile-time error - not cast-compatible } {
    empty_class T15202n5 {
	boolean b = new int[1] instanceof Runnable;
    }
} FAIL

tcltest::test 15.20-2-never-6 { Compile-time error - not cast-compatible } {
    empty_class T15202n6 {
	boolean b = new int[1] instanceof Object[];
    }
} FAIL

tcltest::test 15.20-2-never-7 { Compile-time error - not cast-compatible } {
    empty_class T15202n7 {
	boolean b = new byte[1] instanceof short[];
    }
} FAIL
