return false
end
- return a.a is _a
+ return a.a.is_same_instance(_a)
end
init(b: Int)
'\n'.output
-(a1 is a1).output
-(a1 is a2).output
-(not a1 is a3).output
-(not a1 is b1).output
-(not b1 is b2).output
-(not b1 is b3).output
+(a1.is_same_instance(a1)).output
+(a1.is_same_instance(a2)).output
+(not a1.is_same_instance(a3)).output
+(not a1.is_same_instance(b1)).output
+(not b1.is_same_instance(b2)).output
+(not b1.is_same_instance(b3)).output
'\n'.output
om.output
o1.output
-(fp is fp).output
-(fp is fm).output
-(not fp is f1).output
-(fp is ofp).output
-(fp is ofm).output
-(not fp is of1).output
-(fp is op).output
-(fp is om).output
-(not fp is o1).output
+(fp.is_same_instance(fp)).output
+(fp.is_same_instance(fm)).output
+(not fp.is_same_instance(f1)).output
+(fp.is_same_instance(ofp)).output
+(fp.is_same_instance(ofm)).output
+(not fp.is_same_instance(of1)).output
+(fp.is_same_instance(op)).output
+(fp.is_same_instance(om)).output
+(not fp.is_same_instance(o1)).output
'\n'.output
-(fm is fp).output
-(fm is fm).output
-(not fm is f1).output
-(fm is ofp).output
-(fm is ofm).output
-(not fm is of1).output
-(fm is op).output
-(fm is om).output
-(not fm is o1).output
+(fm.is_same_instance(fp)).output
+(fm.is_same_instance(fm)).output
+(not fm.is_same_instance(f1)).output
+(fm.is_same_instance(ofp)).output
+(fm.is_same_instance(ofm)).output
+(not fm.is_same_instance(of1)).output
+(fm.is_same_instance(op)).output
+(fm.is_same_instance(om)).output
+(not fm.is_same_instance(o1)).output
'\n'.output
-(ofp is fp).output
-(ofp is fm).output
-(not ofp is f1).output
-(ofp is ofp).output
-(ofp is ofm).output
-(not ofp is of1).output
-(ofp is op).output
-(ofp is om).output
-(not ofp is o1).output
+(ofp.is_same_instance(fp)).output
+(ofp.is_same_instance(fm)).output
+(not ofp.is_same_instance(f1)).output
+(ofp.is_same_instance(ofp)).output
+(ofp.is_same_instance(ofm)).output
+(not ofp.is_same_instance(of1)).output
+(ofp.is_same_instance(op)).output
+(ofp.is_same_instance(om)).output
+(not ofp.is_same_instance(o1)).output
'\n'.output
-(ofm is fp).output
-(ofm is fm).output
-(not ofm is f1).output
-(ofm is ofp).output
-(ofm is ofm).output
-(not ofm is of1).output
-(ofm is op).output
-(ofm is om).output
-(not ofm is o1).output
+(ofm.is_same_instance(fp)).output
+(ofm.is_same_instance(fm)).output
+(not ofm.is_same_instance(f1)).output
+(ofm.is_same_instance(ofp)).output
+(ofm.is_same_instance(ofm)).output
+(not ofm.is_same_instance(of1)).output
+(ofm.is_same_instance(op)).output
+(ofm.is_same_instance(om)).output
+(not ofm.is_same_instance(o1)).output
'\n'.output
-(op is fp).output
-(op is fm).output
-(not op is f1).output
-(op is ofp).output
-(op is ofm).output
-(not op is of1).output
-(op is op).output
-(op is om).output
-(not op is o1).output
+(op.is_same_instance(fp)).output
+(op.is_same_instance(fm)).output
+(not op.is_same_instance(f1)).output
+(op.is_same_instance(ofp)).output
+(op.is_same_instance(ofm)).output
+(not op.is_same_instance(of1)).output
+(op.is_same_instance(op)).output
+(op.is_same_instance(om)).output
+(not op.is_same_instance(o1)).output
'\n'.output
-(om is fp).output
-(om is fm).output
-(not om is f1).output
-(om is ofp).output
-(om is ofm).output
-(not om is of1).output
-(om is op).output
-(om is om).output
-(not om is o1).output
+(om.is_same_instance(fp)).output
+(om.is_same_instance(fm)).output
+(not om.is_same_instance(f1)).output
+(om.is_same_instance(ofp)).output
+(om.is_same_instance(ofm)).output
+(not om.is_same_instance(of1)).output
+(om.is_same_instance(op)).output
+(om.is_same_instance(om)).output
+(not om.is_same_instance(o1)).output
'\n'.output
-(a is 5).output
-(not a is 6).output
-(a is a).output
-(a is b).output
-(a is c).output
-(not a is d).output
-(not a is e).output
+(a.is_same_instance(5)).output
+(not a.is_same_instance(6)).output
+(a.is_same_instance(a)).output
+(a.is_same_instance(b)).output
+(a.is_same_instance(c)).output
+(not a.is_same_instance(d)).output
+(not a.is_same_instance(e)).output
'\n'.output
'\n'.output
-(c is 5).output
-(not c is 6).output
-(c is a).output
-(c is b).output
-(c is c).output
-(not c is d).output
-(not c is e).output
+(c.is_same_instance(5)).output
+(not c.is_same_instance(6)).output
+(c.is_same_instance(a)).output
+(c.is_same_instance(b)).output
+(c.is_same_instance(c)).output
+(not c.is_same_instance(d)).output
+(not c.is_same_instance(e)).output
'\n'.output
import end
class Object
- fun ==(o: nullable Object): Bool do return self is o
+ fun ==(o: nullable Object): Bool do return self.is_same_instance(o)
fun !=(o: nullable Object): Bool do return not (self == o)
+ fun is_same_instance(other: nullable Object): Bool is intern
end
-
class Bool
fun output is intern
end
(2==2).output
'\n'.output
-(not 1 is 2).output
-(2 is 2).output
+(not 1.is_same_instance(2)).output
+(2.is_same_instance(2)).output
'\n'.output
(not 1>2).output
(two==two).output
'\n'.output
-(not one is two).output
-(two is two).output
+(not one.is_same_instance(two)).output
+(two.is_same_instance(two)).output
'\n'.output
(not one>two).output
var a = new A
a.foo
-#alt1# if a is a then 2.output
+#alt1# if a isa Int then 2.output
import end
class Object
- fun ==(o: nullable Object): Bool do return self is o
- fun !=(o: nullable Object): Bool do return not self is o
+ fun ==(o: nullable Object): Bool do return self.is_same_instance(o)
+ fun !=(o: nullable Object): Bool do return not self.is_same_instance(o)
+ fun is_same_instance(other: nullable Object): Bool is intern
end
-
class A
end
import end
class Object
- fun ==(o: nullable Object): Bool do return self is o
- fun !=(o: nullable Object): Bool do return not self is o
+ fun ==(o: nullable Object): Bool do return self.is_same_instance(o)
+ fun !=(o: nullable Object): Bool do return not self.is_same_instance(o)
+ fun is_same_instance(other: nullable Object): Bool is intern
end
-
class A
end
# limitations under the License.
import end
-
class Object
- fun ==(o: nullable Object): Bool do return self is o
+ fun ==(o: nullable Object): Bool do return self.is_same_instance(o)
fun !=(o: nullable Object): Bool do return not self == o
+ fun is_same_instance(o: nullable Object): Bool is intern
end
class A
end
trash(fail != 1) # no rtype
trash(1 != fail)
trash(fail != fail) # no rtype
-trash(fail is 1)
-trash(1 is fail)
-trash(fail is fail)
+trash(fail.is_same_instance(1))
+trash(1.is_same_instance(fail))
+trash(fail.is_same_instance(fail))
trash(fail < 1) # no rtype
trash(1 < fail)
trash(fail < fail) # no rtype
redef fun ==(p)
do
- return not p is null and p isa Point and _x == p.x and _y == p.y
+ return p isa Point and _x == p.x and _y == p.y
end
-alt/base_no_object_alt1.nit:13,4--9: Type Error: missing primitive class `Bool'.
-alt/base_no_object_alt1.nit:13,4--9: Type Error: missing primitive class `Bool'.
+alt/base_no_object_alt1.nit:13,4--12: Type Error: missing primitive class `Bool'.
+alt/base_no_object_alt1.nit:13,4--12: Type Error: missing primitive class `Bool'.
error_expr_not_ok.nit:84,7--15: Type error: expected A, got Bool
error_expr_not_ok.nit:85,7--10: Error: Method or variable 'fail' unknown in Sys.
error_expr_not_ok.nit:86,7--10: Error: Method or variable 'fail' unknown in Sys.
-error_expr_not_ok.nit:86,7--15: Type error: expected A, got Bool
-error_expr_not_ok.nit:87,12--15: Error: Method or variable 'fail' unknown in Sys.
-error_expr_not_ok.nit:87,7--15: Type error: expected A, got Bool
+error_expr_not_ok.nit:87,26--29: Error: Method or variable 'fail' unknown in Sys.
+error_expr_not_ok.nit:87,7--30: Type error: expected A, got Bool
error_expr_not_ok.nit:88,7--10: Error: Method or variable 'fail' unknown in Sys.
-error_expr_not_ok.nit:88,15--18: Error: Method or variable 'fail' unknown in Sys.
-error_expr_not_ok.nit:88,7--18: Type error: expected A, got Bool
error_expr_not_ok.nit:89,7--10: Error: Method or variable 'fail' unknown in Sys.
error_expr_not_ok.nit:90,11--14: Error: Method or variable 'fail' unknown in Sys.
error_expr_not_ok.nit:90,7--14: Type error: expected A, got Bool
alt/error_expr_not_ok_alt2.nit:79,7--14: Type error: expected A, got Bool
alt/error_expr_not_ok_alt2.nit:81,7--15: Type error: expected A, got Bool
alt/error_expr_not_ok_alt2.nit:84,7--15: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt2.nit:86,7--15: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt2.nit:87,7--15: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt2.nit:88,7--18: Type error: expected A, got Bool
+alt/error_expr_not_ok_alt2.nit:87,7--30: Type error: expected A, got Bool
alt/error_expr_not_ok_alt2.nit:90,7--14: Type error: expected A, got Bool
alt/error_expr_not_ok_alt2.nit:93,7--14: Type error: expected A, got Bool
alt/error_expr_not_ok_alt2.nit:96,7--15: Type error: expected A, got Bool
alt/error_expr_not_ok_alt3.nit:79,7--14: Type error: expected A, got Bool
alt/error_expr_not_ok_alt3.nit:81,7--15: Type error: expected A, got Bool
alt/error_expr_not_ok_alt3.nit:84,7--15: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt3.nit:86,7--15: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt3.nit:87,7--15: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt3.nit:88,7--18: Type error: expected A, got Bool
+alt/error_expr_not_ok_alt3.nit:87,7--30: Type error: expected A, got Bool
alt/error_expr_not_ok_alt3.nit:90,7--14: Type error: expected A, got Bool
alt/error_expr_not_ok_alt3.nit:93,7--14: Type error: expected A, got Bool
alt/error_expr_not_ok_alt3.nit:96,7--15: Type error: expected A, got Bool
alt/error_expr_not_ok_alt4.nit:83,7--15: Type error: expected A, got Bool
alt/error_expr_not_ok_alt4.nit:84,7--15: Type error: expected A, got Bool
alt/error_expr_not_ok_alt4.nit:85,7--18: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt4.nit:86,7--15: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt4.nit:87,7--15: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt4.nit:88,7--18: Type error: expected A, got Bool
+alt/error_expr_not_ok_alt4.nit:86,7--30: Type error: expected A, got Bool
+alt/error_expr_not_ok_alt4.nit:87,7--30: Type error: expected A, got Bool
+alt/error_expr_not_ok_alt4.nit:88,7--33: Type error: expected A, got Bool
alt/error_expr_not_ok_alt4.nit:89,7--14: Type error: expected A, got Bool
alt/error_expr_not_ok_alt4.nit:90,7--14: Type error: expected A, got Bool
alt/error_expr_not_ok_alt4.nit:91,7--17: Type error: expected A, got Bool
alt/error_expr_not_ok_alt5.nit:83,7--15: Type error: expected A, got Bool
alt/error_expr_not_ok_alt5.nit:84,7--15: Type error: expected A, got Bool
alt/error_expr_not_ok_alt5.nit:85,7--18: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt5.nit:86,7--15: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt5.nit:87,7--15: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt5.nit:88,7--18: Type error: expected A, got Bool
+alt/error_expr_not_ok_alt5.nit:86,7--30: Type error: expected A, got Bool
+alt/error_expr_not_ok_alt5.nit:87,7--30: Type error: expected A, got Bool
+alt/error_expr_not_ok_alt5.nit:88,7--33: Type error: expected A, got Bool
alt/error_expr_not_ok_alt5.nit:89,7--14: Type error: expected A, got Bool
alt/error_expr_not_ok_alt5.nit:90,7--14: Type error: expected A, got Bool
alt/error_expr_not_ok_alt5.nit:91,7--17: Type error: expected A, got Bool
alt/error_expr_not_ok_alt6.nit:83,7--15: Type error: expected A, got Bool
alt/error_expr_not_ok_alt6.nit:84,7--15: Type error: expected A, got Bool
alt/error_expr_not_ok_alt6.nit:85,7--18: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt6.nit:86,7--15: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt6.nit:87,7--15: Type error: expected A, got Bool
-alt/error_expr_not_ok_alt6.nit:88,7--18: Type error: expected A, got Bool
+alt/error_expr_not_ok_alt6.nit:86,7--30: Type error: expected A, got Bool
+alt/error_expr_not_ok_alt6.nit:87,7--30: Type error: expected A, got Bool
+alt/error_expr_not_ok_alt6.nit:88,7--33: Type error: expected A, got Bool
alt/error_expr_not_ok_alt6.nit:89,7--14: Type error: expected A, got Bool
alt/error_expr_not_ok_alt6.nit:90,7--14: Type error: expected A, got Bool
alt/error_expr_not_ok_alt6.nit:91,7--17: Type error: expected A, got Bool
+++ /dev/null
-* literal int
-true
-true
-true
-true
-* int variable
-true
-true
-true
-true
-true
-* same type object
-true
-true
-true
-true
-true
-* different type object
-true
-true
-true
-* boxed native
-true
-true
-true
-true
-true
-true
-true
-* null
-true
-true
-true
-true
-true
-true
-true
-true
-true
-true
-true
+++ /dev/null
-* literal int
-true
-true
-true
-true
-* int variable
-true
-true
-true
-true
-true
-* same type object
-true
-true
-true
-true
-true
-true
-* different type object
-true
-true
-* boxed native
-true
-true
-true
-true
-true
-true
+++ /dev/null
-okokokokokokokokokokokokokokokokokokokok
\ No newline at end of file
+++ /dev/null
-111111111
\ No newline at end of file
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.org>
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-var i = 1
-var j = 1
-var k = 2
-var s = "Maison"
-var t = "Maison"
-var a: Object
-var b: Object
-
-print("* literal int")
-print(1 is 1)
-print(1 is 1)
-print(not 1 is 2)
-print(not 1 is 2)
-print("* int variable")
-print(i is j)
-print(j is i)
-print(not i is k)
-print(i is 1)
-print(not i is 2)
-
-print("* same type object")
-print(s is s)
-a = s
-print(s is a)
-a = s
-print(not s is t)
-b = t
-print(not s is b)
-print(not s is b)
-
-print("* different type object")
-a = s.iterator
-print(not s is a)
-a = 5
-print(not s is a)
-print(not s is 5)
-
-print("* boxed native")
-a = i
-b = i
-print(i is a)
-print(b is i)
-print(b is a)
-a = 5
-b = 5.ascii
-print(not 5 is 5.ascii)
-print(not a is 5.ascii)
-print(not 5 is b)
-print(not a is b)
-
-print("* null")
-var a1: nullable Object = null
-var b1: nullable Object = null
-print(not null is s)
-print(not s is null)
-print(not a1 is s)
-print(not s is a1)
-print(null is null)
-print(b1 is null)
-print(b1 is a1)
-print(not i is null)
-print(not i is a1)
-print(not null is i)
-print(not a1 is i)
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.org>
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-var i = 1
-var j = 1
-var k = 2
-var s = "Maison"
-var t = "Maison"
-var u = "Arbre"
-var a: Object
-var b: Object
-print("* literal int")
-print(1 == 1)
-print(not 1 != 1)
-print(not 1 == 2)
-print(1 != 2)
-print("* int variable")
-print(i == j)
-print(j == i)
-print(i != k)
-print(i == 1)
-print(i != 2)
-
-print("* same type object")
-print(s == s)
-a = s
-print(a == s)
-a = s
-print(s == t)
-b = t
-print(b == s)
-print(not s == u)
-b = u
-print(not b == s)
-
-print("* different type object")
-a = s.iterator
-print(not a == s)
-a = 5
-print(not a == s)
-
-print("* boxed native")
-a = i
-b = i
-print(a == i)
-print(b == i)
-print(b == a)
-a = 5
-b = 5.ascii
-print(not a == 5.ascii)
-print(not b == 5)
-print(not a == b)
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.org>
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-var i: Int
-var j: Int
-var a: Object
-var b: Object
-if 1 == 1 then printn("ok") else printn("fail")
-if not 1 == 2 then printn("ok") else printn("fail")
-if 1 is 1 then printn("ok") else printn("fail")
-if not 1 is 2 then printn("ok") else printn("fail")
-i = 1
-if i == 1 then printn("ok") else printn("fail")
-if not i == 2 then printn("ok") else printn("fail")
-if i is 1 then printn("ok") else printn("fail")
-if not i is 2 then printn("ok") else printn("fail")
-j = 1
-if i == j then printn("ok") else printn("fail")
-if i is j then printn("ok") else printn("fail")
-a = 1
-if a == i then printn("ok") else printn("fail")
-if a is i then printn("ok") else printn("fail")
-a = i
-if a == i then printn("ok") else printn("fail")
-if a is i then printn("ok") else printn("fail")
-b = a
-if a == b then printn("ok") else printn("fail")
-if a is b then printn("ok") else printn("fail")
-b = i
-if a == b then printn("ok") else printn("fail")
-if a is b then printn("ok") else printn("fail")
-b = 1
-if a == b then printn("ok") else printn("fail")
-if a is b then printn("ok") else printn("fail")
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.org>
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-class A
- init do end
-end
-
-var a: nullable A = new A
-var b: nullable A = null
-if a == null then printn(0) else printn(1)
-if a is null then printn(0) else printn(1)
-#if b == null then printn(1) else printn(0)
-if b is null then printn(1) else printn(0)
-if a == a then printn(1) else printn(0)
-if a is a then printn(1) else printn(0)
-#if b == b then printn(1) else printn(0)
-if b is b then printn(1) else printn(0)
-if a == b then printn(0) else printn(1)
-if a is b then printn(0) else printn(1)
-#if b == a then printn(0) else printn(1)
-if b is a then printn(0) else printn(1)
-
1.output
(s1.to_s == s2.to_s).output
-(s1.to_s is s2.to_s).output
+(s1.to_s.is_same_instance(s2.to_s)).output
(s1.to_s == s3.to_s).output
-(s1.to_s is s3.to_s).output
+(s1.to_s.is_same_instance(s3.to_s)).output
2.output
(s1 == s2).output
-(s1 is s2).output
+(s1.is_same_instance(s2)).output
(s1 == s3).output
-(s1 is s3).output
+(s1.is_same_instance(s3)).output