Remove some obsolete tests.
Fix broken tests.
Add missing *.sav files
Add mal *.fail files.
Signed-off-by: Jean Privat <jean@pryen.org>
#alt4#var a = new A[A[Int]]
#alt5#var a = new A[A[U]]
- var f: Float
+ var f: Float = 1.0
a.foo(f)
f = a.foo2
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2006-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.
-
-import kernel
-
-class A
- fun foo
- do
- 0.output
- end
-end
-
-class B
-special A
- redef fun foo
- do
- 1.output
- end
-end
-
-class C
-special A
- redef fun foo
- do
- 2.output
- end
-end
-
-class D
-special B
-special C
- redef fun foo
- do
- super
- end
-end
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2006-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.
-
-import kernel
-class A
- fun bar(a: Object)
- do
- a.output
- end
- redef fun output
- do
- 'A'.output
- end
-
- fun ret_test
- # see rterror_cov_ret
- do
- ret.output
- end
- fun ret: A
- do
- return self
- end
-
- init do end
-end
-
-class B
-special A
- redef fun bar(a: B)
- do
- a.output
- end
- redef fun output
- do
- 'B'.output
- end
- redef fun ret: B
- do
- return self
- end
-
- init do end
-end
-
-var a = new A
-var b = a
-b = new B
-b.bar(5)
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2006-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.
-
-import rterror_cov_param
-redef class A
- redef fun ret: Object
- do
- return 5
- end
-end
-
-var a = new A
-#a = new B
-a.ret_test
+++ /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.
-
-import kernel
-
-class A
- fun foo(i: Int)
- do
- i.output
- if i == 1 then
- return
- end
- if i % 2 == 0 then
- bar(i)
- else
- baz(self, i)
- end
- end
-
- fun bar(i: Int)
- do
- foo(i/2)
- end
-
- init do end
-end
-
-class B
-special A
- redef fun foo(i: Int)
- do
- if i == 1 then
- var a: A
- a.foo(i) # Nil call
- end
- super
- end
-
- init do end
-end
-
-fun baz(a: A, i: Int)
-do
- a.foo(i+3)
-end
-
-var a = new A
-a.foo(5)
-a = new B
-a.foo(5)
+++ /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.
-
-import kernel
-
-class Foo
- var _attr: Object
-
- init do
- _attr = 0
- end
-end
-
-var f = new Foo
-f._attr = 1
-f._attr.output
-f = null
-f._attr = 2
-f._attr.output
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2005-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.
-
-import kernel
-
-class Foo
- fun bar
- do
- baz.output
- end
-
- fun baz: Int
- do
- return 5
- end
-
- init do end
-end
-
-var f = new Foo
-f.bar
-f = null
-f.bar
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2005-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.
-
-import kernel
-
-redef class Object
- fun foo
- do
- 0.output
- end
-end
-
-redef class Int
- redef fun foo
- do
- output
- end
-end
-
-redef class Char
- redef fun foo
- do
- ascii.foo
- end
-end
-
-class Foo
- redef fun foo
- do
- 5.output
- end
-
- init do end
-end
-
-class Bar
- redef fun foo
- do
- 6.output
- end
-
- init do end
-end
-
-var a: Object
-a = new Foo
-a = new Bar
-a.foo
-a = null
-a.foo
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2006-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.
-
-import kernel
-
-class A
- fun foo
- do
- 1.output
- end
- fun bar: Int
- do
- return 2
- end
-end
-
-var a: A = null
-a.bar.output
-a.foo
--- /dev/null
+0
+10
+20
+21
+40
+5
+6
--- /dev/null
+0
+10
+40
+5
+6
--- /dev/null
+alt/base_closure_raf_alt10.nit:50,3--7: Error: foo requires 1 blocks.
--- /dev/null
+alt/base_closure_raf_alt11.nit:39,8--47:14: Error: 1 automatic variable names expected, 0 found.
--- /dev/null
+alt/base_closure_raf_alt12.nit:30,7--9: Type error: expected Int, got Char
--- /dev/null
+alt/base_closure_raf_alt13.nit:27,3--8: Error: 'bar' arity missmatch.
--- /dev/null
+alt/base_closure_raf_alt14.nit:27,7--8: Type error: expected Bool, got Int
--- /dev/null
+0
+10
+20
+21
+40
+5
+6
--- /dev/null
+alt/base_closure_raf_alt2.nit:29,3--5: Error: 'bar' arity missmatch.
--- /dev/null
+alt/base_closure_raf_alt3.nit:31,11--15: Type error: expected expression.
--- /dev/null
+0
+10
+20
+5
+6
--- /dev/null
+alt/base_closure_raf_alt5.nit:43,3--11: Error: break without value required in this block.
--- /dev/null
+0
+10
+20
+40
+5
+6
--- /dev/null
+alt/base_closure_raf_alt7.nit:45,3--14: Error: continue without value required in this block.
--- /dev/null
+0
+10
+20
+6
--- /dev/null
+alt/base_closure_raf_alt9.nit:47,3--12: Error: Return with value in a procedure.
--- /dev/null
+I
+true
+true
+true
+true
+0
+B
+true
+true
+true
+true
+C
+true
+true
+true
+true
--- /dev/null
+I
+true
+true
+true
+true
+B
+true
+true
+true
+true
+false
+C
+true
+true
+true
+true
--- /dev/null
+I
+true
+true
+true
+true
+B
+true
+true
+true
+true
+C
+true
+true
+true
+true
+0
--- /dev/null
+Aborted in abstract_collection::CoupleMap::(abstract_collection::MapRead::[]) (../bin/../lib/standard//abstract_collection.nit:384)
+,---- Stack trace -- - - -
+| abstract_collection::CoupleMap::(abstract_collection::MapRead::[]) (../bin/../lib/standard//abstract_collection.nit:380)
+| abstractmetamodel::MMModule::class_by_name (./metamodel//abstractmetamodel.nit:214)
+| syntax_base::AbsSyntaxVisitor::type_array (./syntax//syntax_base.nit:299)
+| mmbuilder::PParam::(mmbuilder::PNode::accept_property_verifier) (./syntax//mmbuilder.nit:1166)
+| mmbuilder::PropertyVerifierVisitor::(parser_prod::Visitor::visit) (./syntax//mmbuilder.nit:371)
+| parser_prod::ASignature::(parser_prod::PNode::visit_all) (./parser//parser_prod.nit:3775)
+| syntax_base::PNode::accept_abs_syntax_visitor (./syntax//syntax_base.nit:445)
+| mmbuilder::PNode::accept_property_verifier (./syntax//mmbuilder.nit:409)
+| mmbuilder::ASignature::(mmbuilder::PNode::accept_property_verifier) (./syntax//mmbuilder.nit:1114)
+| mmbuilder::PropertyVerifierVisitor::(parser_prod::Visitor::visit) (./syntax//mmbuilder.nit:371)
+| parser_prod::AConcreteMethPropdef::(parser_prod::PNode::visit_all) (./parser//parser_prod.nit:2347)
+| syntax_base::PNode::accept_abs_syntax_visitor (./syntax//syntax_base.nit:445)
+| mmbuilder::AMethPropdef::(syntax_base::PNode::accept_abs_syntax_visitor) (./syntax//mmbuilder.nit:1034)
+| mmbuilder::PNode::accept_property_verifier (./syntax//mmbuilder.nit:409)
+| mmbuilder::AMethPropdef::(mmbuilder::PNode::accept_property_verifier) (./syntax//mmbuilder.nit:1014)
+| mmbuilder::PropertyVerifierVisitor::(parser_prod::Visitor::visit) (./syntax//mmbuilder.nit:371)
+| parser_prod::ATopClassdef::(parser_prod::PNode::visit_all) (./parser//parser_prod.nit:881)
+| syntax_base::PNode::accept_abs_syntax_visitor (./syntax//syntax_base.nit:445)
+| mmbuilder::PClassdef::(syntax_base::PNode::accept_abs_syntax_visitor) (./syntax//mmbuilder.nit:547)
+| mmbuilder::PNode::accept_property_verifier (./syntax//mmbuilder.nit:409)
+| mmbuilder::PropertyVerifierVisitor::(parser_prod::Visitor::visit) (./syntax//mmbuilder.nit:371)
+| mmbuilder::MMSrcLocalClass::(mmbuilder::MMLocalClass::accept_properties_visitor) (./syntax//mmbuilder.nit:144)
+| mmbuilder::MMSrcModule::do_mmbuilder (./syntax//mmbuilder.nit:36)
+| syntax::MMSrcModule::process_syntax (./syntax//syntax.nit:66)
+| syntax::SrcModuleLoader::(mmloader::ModuleLoader::process_metamodel) (./syntax//syntax.nit:49)
+| mmloader::ModuleLoader::load_and_process_module (./mmloader.nit:277)
+| mmloader::ToolContext::try_to_load (./mmloader.nit:129)
+| mmloader::ToolContext::get_module_from_filename (./mmloader.nit:175)
+| abstracttool::AbstractCompiler::exec_cmd_line (./abstracttool.nit:40)
+| nitc::Sys::(kernel::Sys::main) (./nitc.nit:105)
+`------------------- - - -
--- /dev/null
+./base_virtual_type_self.nit:44,3--3: Error: Method or variable 'a' unknown in B.
+./base_virtual_type_self.nit:45,7--7: Error: Method or variable 'a' unknown in B.
+./base_virtual_type_self.nit:46,3--3: Error: Method or variable 'a' unknown in B.
+./base_virtual_type_self.nit:47,7--7: Error: Method or variable 'a' unknown in B.
--- /dev/null
+alt/base_virtual_type_self_alt1.nit:44,9--9: Type error: expected Int, got Float
+alt/base_virtual_type_self_alt1.nit:45,7--12: Type error: expected Float, got Int
+alt/base_virtual_type_self_alt1.nit:46,9--9: Type error: expected A[T], got Float
+alt/base_virtual_type_self_alt1.nit:47,7--12: Type error: expected Float, got A[T]
--- /dev/null
+alt/base_virtual_type_self_alt2.nit:44,9--9: Type error: expected Int, got Float
+alt/base_virtual_type_self_alt2.nit:45,7--12: Type error: expected Float, got Int
+alt/base_virtual_type_self_alt2.nit:46,9--9: Type error: expected A[T], got Float
+alt/base_virtual_type_self_alt2.nit:47,7--12: Type error: expected Float, got A[T]
--- /dev/null
+alt/base_virtual_type_self_alt3.nit:44,9--9: Type error: expected Int, got Float
+alt/base_virtual_type_self_alt3.nit:45,7--12: Type error: expected Float, got Int
+alt/base_virtual_type_self_alt3.nit:46,9--9: Type error: expected A[T], got Float
+alt/base_virtual_type_self_alt3.nit:47,7--12: Type error: expected Float, got A[T]
--- /dev/null
+alt/base_virtual_type_self_alt4.nit:44,9--9: Type error: expected A[Int], got Float
+alt/base_virtual_type_self_alt4.nit:45,7--12: Type error: expected Float, got A[Int]
+alt/base_virtual_type_self_alt4.nit:46,9--9: Type error: expected A[T], got Float
+alt/base_virtual_type_self_alt4.nit:47,7--12: Type error: expected Float, got A[T]
--- /dev/null
+alt/base_virtual_type_self_alt5.nit:44,9--9: Type error: expected A[U], got Float
+alt/base_virtual_type_self_alt5.nit:45,7--12: Type error: expected Float, got A[U]
+alt/base_virtual_type_self_alt5.nit:46,9--9: Type error: expected A[T], got Float
+alt/base_virtual_type_self_alt5.nit:47,7--12: Type error: expected Float, got A[T]
--- /dev/null
+./tests.sh: line 119: ./error_class_glob.bin: No such file or directory
--- /dev/null
+./error_ref_param.nit:20,2--17: Redef error: Expected B (as in C::r), got C in C::r.
--- /dev/null
+./error_type_not_ok2.nit:21,15: Type error: class Fail not found in module error_type_not_ok2.
+Cast failled in static_type::MMAncestor::stype (./metamodel//static_type.nit:265)
+,---- Stack trace -- - - -
+| static_type::MMAncestor::stype (./metamodel//static_type.nit:264)
+| inheritance::MMAncestor::add_in (./metamodel//inheritance.nit:384)
+| inheritance::MMLocalClass::build_ancestors (./metamodel//inheritance.nit:243)
+| inheritance::MMLocalClass::compute_ancestors (./metamodel//inheritance.nit:90)
+| mmbuilder::MMSrcModule::do_mmbuilder (./syntax//mmbuilder.nit:36)
+| syntax::MMSrcModule::process_syntax (./syntax//syntax.nit:66)
+| syntax::SrcModuleLoader::(mmloader::ModuleLoader::process_metamodel) (./syntax//syntax.nit:49)
+| mmloader::ModuleLoader::load_and_process_module (./mmloader.nit:277)
+| mmloader::ToolContext::try_to_load (./mmloader.nit:129)
+| mmloader::ToolContext::get_module_from_filename (./mmloader.nit:175)
+| abstracttool::AbstractCompiler::exec_cmd_line (./abstracttool.nit:40)
+| nitc::Sys::(kernel::Sys::main) (./nitc.nit:105)
+`------------------- - - -
--- /dev/null
+alt/error_type_not_ok2_alt1.nit:21,15--18: Type error: 'Fail' is a generic class.
+Cast failled in static_type::MMAncestor::stype (./metamodel//static_type.nit:265)
+,---- Stack trace -- - - -
+| static_type::MMAncestor::stype (./metamodel//static_type.nit:264)
+| inheritance::MMAncestor::add_in (./metamodel//inheritance.nit:384)
+| inheritance::MMLocalClass::build_ancestors (./metamodel//inheritance.nit:243)
+| inheritance::MMLocalClass::compute_ancestors (./metamodel//inheritance.nit:90)
+| mmbuilder::MMSrcModule::do_mmbuilder (./syntax//mmbuilder.nit:36)
+| syntax::MMSrcModule::process_syntax (./syntax//syntax.nit:66)
+| syntax::SrcModuleLoader::(mmloader::ModuleLoader::process_metamodel) (./syntax//syntax.nit:49)
+| mmloader::ModuleLoader::load_and_process_module (./mmloader.nit:277)
+| mmloader::ToolContext::try_to_load (./mmloader.nit:129)
+| mmloader::ToolContext::get_module_from_filename (./mmloader.nit:175)
+| abstracttool::AbstractCompiler::exec_cmd_line (./abstracttool.nit:40)
+| nitc::Sys::(kernel::Sys::main) (./nitc.nit:105)
+`------------------- - - -
--- /dev/null
+alt/error_type_not_ok_alt1.nit:21,9--12: Type error: 'Fail' is a generic class.
+Cast failled in static_type::MMAncestor::stype (./metamodel//static_type.nit:265)
+,---- Stack trace -- - - -
+| static_type::MMAncestor::stype (./metamodel//static_type.nit:264)
+| inheritance::MMAncestor::add_in (./metamodel//inheritance.nit:384)
+| inheritance::MMLocalClass::build_ancestors (./metamodel//inheritance.nit:243)
+| inheritance::MMLocalClass::compute_ancestors (./metamodel//inheritance.nit:90)
+| mmbuilder::MMSrcModule::do_mmbuilder (./syntax//mmbuilder.nit:36)
+| syntax::MMSrcModule::process_syntax (./syntax//syntax.nit:66)
+| syntax::SrcModuleLoader::(mmloader::ModuleLoader::process_metamodel) (./syntax//syntax.nit:49)
+| mmloader::ModuleLoader::load_and_process_module (./mmloader.nit:277)
+| mmloader::ToolContext::try_to_load (./mmloader.nit:129)
+| mmloader::ToolContext::get_module_from_filename (./mmloader.nit:175)
+| abstracttool::AbstractCompiler::exec_cmd_line (./abstracttool.nit:40)
+| nitc::Sys::(kernel::Sys::main) (./nitc.nit:105)
+`------------------- - - -
--- /dev/null
+Fatal error: inherit_local_property error
--- /dev/null
+3140000000 :10
+0000000000 :20
+0000000000 :30
+1100000000 :40
+0000000000 :50
+0000000000 :60
+1100000000 :70
+0000000000 :80
+0000000000 :90
+1100000000 :100
+0000000000 :110
+0000000000 :120
+1100000000 :130
+0000000000 :140
+0000000000 :150
+1100000000 :160
+0000000000 :170
+0000000000 :180
+1100000000 :190
+0000000000 :200
+0000000000 :210
+1100000000 :220
+0000000000 :230
+0000000000 :240
+1100000000 :250
+0000000000 :260
+0000000000 :270
+1100000000 :280
+0000000000 :290
+0000000000 :300
+1100000000 :310
+0000000000 :320
+0000000000 :330
+1100000000 :340
+0000000000 :350
+0000000000 :360
+1100000000 :370
+0000000000 :380
+0000000000 :390
+1100000000 :400
+0000000000 :410
+0000000000 :420
+1100000000 :430
+0000000000 :440
+0000000000 :450
+1100000000 :460
+0000000000 :470
+0000000000 :480
+1100000000 :490
+0000000000 :500
+0000000000 :510
+1100000000 :520
+0000000000 :530
+0000000000 :540
+1100000000 :550
+0000000000 :560
+0000000000 :570
+1100000000 :580
+0000000000 :590
+0000000000 :600
+1100000000 :610
+0000000000 :620
+0000000000 :630
+1100000000 :640
+0000000000 :650
+0000000000 :660
+1100000000 :670
+0000000000 :680
+0000000000 :690
+1100000000 :700
+0000000000 :710
+0000000000 :720
+1100000000 :730
+0000000000 :740
+0000000000 :750
+1100000000 :760
+0000000000 :770
+0000000000 :780
+1100000000 :790
+0000000000 :800
+0000000000 :810
+1100000000 :820
+0000000000 :830
+0000000000 :840
+1100000000 :850
+0000000000 :860
+0000000000 :870
+1100000000 :880
+0000000000 :890
+0000000000 :900
+1100000000 :910
+0000000000 :920
+0000000000 :930
+1100000000 :940
+0000000000 :950
+0000000000 :960
+1100000000 :970
+0000000000 :980
+0000000000 :990
+1100000000 :1000
--- /dev/null
+Fatal error: inherit_local_property error
--- /dev/null
+./test_paire.nit:45,1--50:43: Error: A class Pair is already defined at line 17.
+./test_paire.nit:54,1--58:25: Error: A class Pair is already defined at line 17.
--- /dev/null
+11
+1
+10
+2
+12
+1
+10
+2
+13
+1
+10
+2
--- /dev/null
+AB5
+B5
+5
+AB5
+5
+5
+5
+5
+5
+B5
+5
+5
+5
+5
+5
+5
+5
+5
--- /dev/null
+AB5
+B5
+5
+B5
+B5
+5
+5
+5
+5
+B5
+5
+5
+5
+5
+5
+5
+5
+5
--- /dev/null
+AB5
+B5
+5
+B5
+5
+5
+A5
+5
+5
+B5
+5
+5
+5
+5
+5
+5
+5
+5
--- /dev/null
+AB5
+B5
+5
+B5
+5
+5
+B5
+5
+5
+B5
+5
+5
+5
+5
+5
+5
+5
+5
--- /dev/null
+AB5
+B5
+5
+B5
+5
+5
+5
+B5
+5
+B5
+5
+5
+5
+5
+5
+5
+5
+5
--- /dev/null
+AB5
+B5
+5
+B5
+5
+5
+5
+5
+5
+B5
+5
+5
+B5
+5
+5
+5
+5
+5
+++ /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.
-
-import end
-
-# Base Classes
-
-class Object
-end
-
-class Hashable
-special Object
-end
-# Ancestor: "Object" on "Hashable"
-
-class Comparable
-special Object
-end
-
-class Int
-special Hashable
-special Comparable
-end
-
-# Complex Classes
-
-class Pair[E]
-special Object
-end
-class Pair[F: Hashable]
-special Hashable
-end
-# Ancestor: "ANY": "Object" on "Pair[E: Object]"
-# "HASHABLE": "Hashable" on "Pair[F: Hashable]"
-
-class PairCmp[G: Comparable]
-special Pair[G]
-special Comparable
-end
-# Ancestor: "PAIR": "Pair[G]" on "PairCmp[G: Comparable]"
-# => "ANY": "Object" on "PairCmp[G: Comparable]"
-# => "HASHABLE": "Hashable" on "PairCmp[G: Comparable+Hahsable]"
-# Ancestor: "COMPARABLE": "Comparable" on "PairCmp[G: Comparable]"
-
-class Complex
-special PairCmp[Int]
-end
-# Ancestor: "PAIRCMP": "PairCmp[Int]" on "Complex"
-# => "PAIR": "Pair[Int]" on "Complex"
-# => "ANY": "Object" on "Complex"
-# => "HASHABLE": "Hashable" on "Complex"
-
-# Un ancètre d'une classe c est un couple de types (ancetre, héritier) où héritier est dérivé de c
-# les ancètres indirects de c par la filiation (a, h) sont
-# pour chaque ancètres (aa, ha) de la classe de a
-#
-
-# un type a un contexte.
-# Les ancetres d'une classes c sont un tas de types dont le contexte est dérivé de la classe c
-
-
-# application: type1 x type2 x type3 -> type4 (ex "A[U]" x "A[E: T]" x "B[E,C]" -> "B[U,C]")
-# * map: type1 x type2 -> hash (ex "A[U] x A[E: T]" -> {E->U})
-# * betared: hash x type3 -> type4 (ex {E->U} x "B[E,C]" -> "B[U,C]"
-# * application(x,y,z) = betared(map(x,y), z)
-# remarques :
-# * type2 est la liste des parametres formels
-# * type1 peut contenir des paramètres formels
-# ... l'application est plus compliquée
-
-# application("Pair[Comparable]", "Pair[E: Comparable]", )
class A
type T: A
type U: B
- fun foo(a: T) do a.output
- fun bar(b: U) do b.output
- fun baz(i: Int) do i.output
- redef fun output do 'A'.output
+ fun foo(a: T) do a.out
+ fun bar(b: U) do b.out
+ fun baz(i: Int) do i.out
+ fun out do 'A'.output
init do end
end
special A
redef type T: B
redef type U: Int
- redef fun foo(a: T) do a.output
- redef fun bar(b: U) do b.output
- redef fun baz(i: Int) do i.output
- redef fun output do 'B'.output
+ redef fun foo(a: T) do a.out
+ redef fun bar(b: U) do b.out
+ redef fun baz(i: Int) do i.out
+ redef fun out do 'B'.output
init do end
end
redef class Int
special B
redef type T: Int
- redef fun foo(a: T) do a.output
- redef fun bar(b: U) do b.output
+ redef fun foo(a: T) do a.out
+ redef fun bar(b: U) do b.out
redef fun output is intern
+ redef fun out
+ do
+ var i: Object = self
+ if i isa Int then
+ i.output
+ else
+ 'X'.output
+ end
+ end
+
end
var a = new A