nit.git
14 years agoparser: remove parser_nodes.nit autopatcher
Jean Privat [Sun, 26 Jul 2009 04:14:40 +0000 (00:14 -0400)]
parser: remove parser_nodes.nit autopatcher

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agoparser: differentiate all P* and A* production classes
Jean Privat [Wed, 20 May 2009 21:06:00 +0000 (16:06 -0500)]
parser: differentiate all P* and A* production classes

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: syntax tree is trashed once no more needed
Jean Privat [Sun, 26 Jul 2009 02:32:05 +0000 (22:32 -0400)]
syntax: syntax tree is trashed once no more needed

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: nodes are not directly stored in MMSrc* classes
Jean Privat [Sun, 26 Jul 2009 02:31:20 +0000 (22:31 -0400)]
syntax: nodes are not directly stored in MMSrc* classes

MMSrcModules has to manage the MMSrc->AST associations.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: use chained nodes for MMSrcClasses instead of an array
Jean Privat [Sun, 26 Jul 2009 01:48:25 +0000 (21:48 -0400)]
syntax: use chained nodes for MMSrcClasses instead of an array

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: remove attribute _node in MMSrcAncestor
Jean Privat [Sun, 26 Jul 2009 01:13:38 +0000 (21:13 -0400)]
syntax: remove attribute _node in MMSrcAncestor

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: remove class MMSrcTypeFormalParameter
Jean Privat [Sun, 26 Jul 2009 01:12:27 +0000 (21:12 -0400)]
syntax: remove class MMSrcTypeFormalParameter

Use a standard MMTypeFormalParameter instead.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agoicode: generate null receiver runtime checks
Jean Privat [Sun, 26 Jul 2009 03:07:58 +0000 (23:07 -0400)]
icode: generate null receiver runtime checks

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agoicode: introduce intermediate code representation
Jean Privat [Sun, 26 Jul 2009 00:32:21 +0000 (20:32 -0400)]
icode: introduce intermediate code representation

Missing parts are mainly:
 * identify bests ICode classes
 * keep casted variable static type in icode
 * remove MMSrc* classes dependency on AST

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agocompile: optimize strings in add_instr
Jean Privat [Sun, 26 Jul 2009 00:32:10 +0000 (20:32 -0400)]
compile: optimize strings in add_instr

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: base_attr_iset tests construction check errors
Jean Privat [Sat, 25 Jul 2009 17:16:40 +0000 (13:16 -0400)]
tests: base_attr_iset tests construction check errors

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: some cleaning to prepare intermediate code
Jean Privat [Fri, 24 Jul 2009 10:15:22 +0000 (06:15 -0400)]
syntax: some cleaning to prepare intermediate code

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agolib: redef Array::add (a faster version)
Jean Privat [Fri, 24 Jul 2009 09:38:17 +0000 (05:38 -0400)]
lib: redef Array::add (a faster version)

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: new base_vararg, remove test_star
Jean Privat [Thu, 23 Jul 2009 03:03:18 +0000 (23:03 -0400)]
tests: new base_vararg, remove test_star

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agoparser: optimize lexer.nit
Jean Privat [Thu, 23 Jul 2009 22:10:48 +0000 (18:10 -0400)]
parser: optimize lexer.nit

Use local variables instead of attribute accesses.
Direct access some array internal items.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosrc: remove nc0 and nc1
Jean Privat [Thu, 23 Jul 2009 22:36:19 +0000 (18:36 -0400)]
src: remove nc0 and nc1

Now nc starts from c_src/nitc instead of bin/nitc.
Rationale is that one wants to check that the compiler can really bootstrap.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: remove 'locate' from nodes and visitor
Jean-Sebastien Gelinas [Thu, 16 Jul 2009 18:45:51 +0000 (14:45 -0400)]
tools: remove 'locate' from nodes and visitor

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: add 'relative_to' to Locations
Jean-Sebastien Gelinas [Thu, 16 Jul 2009 16:35:46 +0000 (12:35 -0400)]
tools: add 'relative_to' to Locations

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: add 'fatal_error' to ToolContext and visitor
Jean-Sebastien Gelinas [Fri, 10 Jul 2009 16:09:29 +0000 (12:09 -0400)]
tools: add 'fatal_error' to ToolContext and visitor

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: order messages by line number/column
Jean-Sebastien Gelinas [Thu, 23 Jul 2009 05:29:08 +0000 (01:29 -0400)]
tools: order messages by line number/column

Trivial hack by Jean Privat <jean@pryen.org>:
Rename _sorter as _message_sorter

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: group message output
Jean-Sebastien Gelinas [Fri, 10 Jul 2009 16:25:51 +0000 (12:25 -0400)]
tools: group message output

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: errors and warnings need Location
Jean-Sebastien Gelinas [Mon, 13 Jul 2009 14:05:59 +0000 (10:05 -0400)]
tools: errors and warnings need Location

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: add useful functions to Location
Jean-Sebastien Gelinas [Thu, 23 Jul 2009 05:15:43 +0000 (01:15 -0400)]
tools: add useful functions to Location

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: add Location to MMModule
Jean-Sebastien Gelinas [Thu, 23 Jul 2009 05:25:30 +0000 (01:25 -0400)]
tools: add Location to MMModule

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: move Location in its own file
Jean-Sebastien Gelinas [Thu, 23 Jul 2009 05:24:36 +0000 (01:24 -0400)]
tools: move Location in its own file

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agometamodel: new MMMethod::is_intern & is_abstract
Jean Privat [Wed, 15 Jul 2009 15:45:12 +0000 (11:45 -0400)]
metamodel: new MMMethod::is_intern & is_abstract

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: add PClosureDecl::position
Jean Privat [Wed, 15 Jul 2009 15:32:38 +0000 (11:32 -0400)]
syntax: add PClosureDecl::position

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agocompile: promote add_assignment and out_contexts
Jean Privat [Wed, 15 Jul 2009 15:28:30 +0000 (11:28 -0400)]
compile: promote add_assignment and out_contexts

Move them from compiling_methods to compiling_base.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agocompile: new package primitive_info
Jean Privat [Wed, 15 Jul 2009 15:16:49 +0000 (11:16 -0400)]
compile: new package primitive_info

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agolib: improve list iterator
Jean Privat [Fri, 10 Jul 2009 19:48:07 +0000 (15:48 -0400)]
lib: improve list iterator

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agoparser: add Visitor::current_node and Visitor::enter_visit
Jean Privat [Wed, 15 Jul 2009 15:11:39 +0000 (11:11 -0400)]
parser: add Visitor::current_node and Visitor::enter_visit

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: new ToolContext::check_errors
Jean-Sebastien Gelinas [Mon, 13 Jul 2009 14:10:19 +0000 (10:10 -0400)]
tools: new ToolContext::check_errors

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: cleanup after insertion of 'Location' class
Jean-Sebastien Gelinas [Sat, 11 Jul 2009 04:59:10 +0000 (00:59 -0400)]
tools: cleanup after insertion of 'Location' class

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agoparser: use printf instead of echo -n
Jean-Sebastien Gelinas [Sat, 11 Jul 2009 20:54:03 +0000 (16:54 -0400)]
parser: use printf instead of echo -n

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agoparser: better compatibility with 'sed' script
Jean-Sebastien Gelinas [Fri, 10 Jul 2009 05:19:43 +0000 (01:19 -0400)]
parser: better compatibility with 'sed' script

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agoclib: add signal 'SIGBUS' for compatibility with MAC
Jean-Sebastien Gelinas [Sat, 11 Jul 2009 05:01:42 +0000 (01:01 -0400)]
clib: add signal 'SIGBUS' for compatibility with MAC

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: add a 'failed' target to test makefile
Jean-Sebastien Gelinas [Mon, 13 Jul 2009 13:20:02 +0000 (09:20 -0400)]
tools: add a 'failed' target to test makefile

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agomisc: gtksourceview nit syntax highlighting
Alexis Laferrière [Mon, 13 Jul 2009 18:05:11 +0000 (14:05 -0400)]
misc: gtksourceview nit syntax highlighting

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: add 'Location' class to use in AST and errors
Jean-Sebastien Gelinas [Fri, 10 Jul 2009 20:54:13 +0000 (16:54 -0400)]
tools: add 'Location' class to use in AST and errors

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: promote some properties and classes from typing to syntax_base
Jean Privat [Wed, 8 Jul 2009 21:49:52 +0000 (17:49 -0400)]
syntax: promote some properties and classes from typing to syntax_base

Some accessors also become non nullable, thus update clients.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agocompile: fatal error on unknown intern method
Jean Privat [Wed, 8 Jul 2009 17:51:56 +0000 (13:51 -0400)]
compile: fatal error on unknown intern method

also fix tests/base_eq_null_notnull that declared an unknown intern method.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agocompile: move init_table management from AST classes to MM classes
Jean Privat [Wed, 8 Jul 2009 16:55:44 +0000 (12:55 -0400)]
compile: move init_table management from AST classes to MM classes

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: change 'rand' test for better portability
Jean-Sebastien Gelinas [Tue, 7 Jul 2009 19:24:56 +0000 (15:24 -0400)]
tests: change 'rand' test for better portability

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: if absent, create classes Object and Bool in root module
Jean Privat [Tue, 7 Jul 2009 20:34:24 +0000 (16:34 -0400)]
syntax: if absent, create classes Object and Bool in root module

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agocompile: work on MM classes instead of MMSrc classes
Jean Privat [Tue, 7 Jul 2009 20:10:34 +0000 (16:10 -0400)]
compile: work on MM classes instead of MMSrc classes

only consider MMSrc classes in special cases.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agometamodel: add MMLocalClass::_local_local_properties
Jean Privat [Tue, 7 Jul 2009 20:09:13 +0000 (16:09 -0400)]
metamodel: add MMLocalClass::_local_local_properties

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: handle compilation errors when nitc succeed but gcc failed
Jean Privat [Tue, 7 Jul 2009 15:21:06 +0000 (11:21 -0400)]
tests: handle compilation errors when nitc succeed but gcc failed

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: remove old bin before compiling
Jean Privat [Tue, 7 Jul 2009 15:12:51 +0000 (11:12 -0400)]
tests: remove old bin before compiling

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: set LANG to avoid locale perturbation
Jean Privat [Tue, 7 Jul 2009 15:09:25 +0000 (11:09 -0400)]
tests: set LANG to avoid locale perturbation

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: do not compute ancestors if syntax failed
Jean Privat [Tue, 7 Jul 2009 15:00:39 +0000 (11:00 -0400)]
syntax: do not compute ancestors if syntax failed

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: enable vararg in bas_sig_inh_alt1
Jean Privat [Tue, 7 Jul 2009 14:46:40 +0000 (10:46 -0400)]
tests: enable vararg in bas_sig_inh_alt1

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: git-gen-version fallback to VERSION file if things goes wrong
Jean Privat [Mon, 6 Jul 2009 19:41:17 +0000 (15:41 -0400)]
tools: git-gen-version fallback to VERSION file if things goes wrong

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: remove --tags from git-describe in git-gen-version.sh
Jean Privat [Mon, 6 Jul 2009 19:34:14 +0000 (15:34 -0400)]
tools: remove --tags from git-describe in git-gen-version.sh

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: do not regenerate nit_version.nit if not needed
Jean Privat [Mon, 6 Jul 2009 19:33:31 +0000 (15:33 -0400)]
tools: do not regenerate nit_version.nit if not needed

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agocompile: spell "failed" correctly
Jean Privat [Mon, 6 Jul 2009 18:29:28 +0000 (14:29 -0400)]
compile: spell "failed" correctly

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: massive update of tests files
Jean Privat [Mon, 6 Jul 2009 18:24:57 +0000 (14:24 -0400)]
tests: massive update of tests files

Remove some obsolete tests.
Fix broken tests.
Add missing *.sav files
Add mal *.fail files.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: tests.sh counts errors
Jean Privat [Mon, 6 Jul 2009 17:29:48 +0000 (13:29 -0400)]
tests: tests.sh counts errors

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: tests.sh compares results with expected buggy results
Jean Privat [Mon, 6 Jul 2009 17:29:26 +0000 (13:29 -0400)]
tests: tests.sh compares results with expected buggy results

New sav/*.fail files stores buggy results in order to track unfixed bugs
or planned regressions.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: add verbose option to tests.sh
Jean Privat [Mon, 6 Jul 2009 17:05:07 +0000 (13:05 -0400)]
tests: add verbose option to tests.sh

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: add option handling to tests.sh
Jean Privat [Mon, 6 Jul 2009 16:59:21 +0000 (12:59 -0400)]
tests: add option handling to tests.sh

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: add test_exec_ls
Jean Privat [Sat, 4 Jul 2009 13:39:13 +0000 (09:39 -0400)]
tests: add test_exec_ls

Since example_exec_ls was unverifiable.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: update base_primitive_null
Jean Privat [Sat, 4 Jul 2009 13:38:14 +0000 (09:38 -0400)]
tests: update base_primitive_null

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: new base_int and base_int2
Jean Privat [Thu, 2 Jul 2009 14:26:04 +0000 (10:26 -0400)]
tests: new base_int and base_int2

Test basic integer operations.

Old base_int is trashed.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: base_closure11 complex stacked and nested closure
Jean Privat [Sat, 4 Jul 2009 02:54:45 +0000 (22:54 -0400)]
tests: base_closure11 complex stacked and nested closure

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: bug to fix: specialize broken type
Jean Privat [Sat, 4 Jul 2009 02:52:02 +0000 (22:52 -0400)]
syntax: bug to fix: specialize broken type

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: do not process erroneous formal types
Jean Privat [Sat, 4 Jul 2009 02:51:08 +0000 (22:51 -0400)]
syntax: do not process erroneous formal types

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: do not processes erroneous signatures
Jean Privat [Sat, 4 Jul 2009 02:44:29 +0000 (22:44 -0400)]
syntax: do not processes erroneous signatures

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: better error message for generic class arity error
Jean Privat [Sat, 4 Jul 2009 02:42:31 +0000 (22:42 -0400)]
syntax: better error message for generic class arity error

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: add base_gen2.nit
Jean Privat [Sat, 4 Jul 2009 02:29:46 +0000 (22:29 -0400)]
tests: add base_gen2.nit

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: add PType::is_typed
Jean Privat [Sat, 4 Jul 2009 02:19:31 +0000 (22:19 -0400)]
syntax: add PType::is_typed

Add tests to ensure that type errors do not crash the compiler.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: add some missing PExpr::is_typed.
Jean Privat [Fri, 3 Jul 2009 21:38:57 +0000 (17:38 -0400)]
syntax: add some missing PExpr::is_typed.

Add a quite complete test to ensure that expression errors do not crash
the compiler.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: move varctx initialization to the PClassdef
Jean Privat [Fri, 3 Jul 2009 21:34:11 +0000 (17:34 -0400)]
syntax: move varctx initialization to the PClassdef

variable 'self' can now be accessed (even implicitly) in default
attribute definition.

A test base_attr_init_val3 is added.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: add test for filter_stream
Jean-Sebastien Gelinas [Tue, 30 Jun 2009 13:27:48 +0000 (09:27 -0400)]
tests: add test for filter_stream

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agolib: add 'close' in filter_stream
Jean-Sebastien Gelinas [Sat, 27 Jun 2009 01:35:09 +0000 (21:35 -0400)]
lib: add 'close' in filter_stream

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agolib: fix nullable in filter_stream
Jean-Sebastien Gelinas [Sat, 27 Jun 2009 01:35:09 +0000 (21:35 -0400)]
lib: fix nullable in filter_stream

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agolib: fix a bug with String::has_substring and related methods
Jean-Sebastien Gelinas [Tue, 16 Jun 2009 17:46:31 +0000 (13:46 -0400)]
lib: fix a bug with String::has_substring and related methods

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: more verbose information
Jean-Sebastien Gelinas [Tue, 23 Jun 2009 18:21:46 +0000 (14:21 -0400)]
tools: more verbose information

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: add 'verbose' options
Jean-Sebastien Gelinas [Wed, 24 Jun 2009 06:04:57 +0000 (02:04 -0400)]
tools: add 'verbose' options

Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

14 years agomisc: add vim syntax and indent files
Jean Privat [Fri, 26 Jun 2009 17:26:46 +0000 (13:26 -0400)]
misc: add vim syntax and indent files

14 years agosyntax: 'meth' -> 'fun', 'attr' -> 'var'
Jean Privat [Fri, 26 Jun 2009 14:40:54 +0000 (10:40 -0400)]
syntax: 'meth' -> 'fun', 'attr' -> 'var'

Tests results are updated to reflect the column change in error messages.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: generate version number and give it to tools
Jean Privat [Fri, 26 Jun 2009 04:55:52 +0000 (00:55 -0400)]
tools: generate version number and give it to tools

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotools: programs know their names
Jean Privat [Fri, 26 Jun 2009 04:53:21 +0000 (00:53 -0400)]
tools: programs know their names

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agonullable: enforce static and dynamic rules.
Jean Privat [Thu, 25 Jun 2009 20:29:26 +0000 (16:29 -0400)]
nullable: enforce static and dynamic rules.

Switch warnings to errors.
Update tests to let them not produce errors. Note that:
 * base_nullable.nit have new error cases
 * test_isa.nit add some test cases
 * test_nil.nit is removed since it is to much outdated.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agonullable: convert lib, tools and tests
Jean Privat [Thu, 25 Jun 2009 02:27:08 +0000 (22:27 -0400)]
nullable: convert lib, tools and tests

Add nullable, as(not null) and cie to libs, nitc, nitdoc and tests such
that they compile and run without nullable-related warnings.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agoc_src: regenerate with soft nullable handling
Jean Privat [Thu, 25 Jun 2009 21:24:17 +0000 (17:24 -0400)]
c_src: regenerate with soft nullable handling

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agometamodel: fix MMType::is_valid for indirect types
Jean Privat [Thu, 25 Jun 2009 21:15:39 +0000 (17:15 -0400)]
metamodel: fix MMType::is_valid for indirect types

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agocompile: no default value for notnull primitive attributes.
Jean Privat [Wed, 24 Jun 2009 19:16:33 +0000 (15:16 -0400)]
compile: no default value for notnull primitive attributes.

However, instead of segfaulting, using an uninitialized attribute may
behave like if it was initialized to 0 (whatever it means).

Therefore the new test base_attr_nullable_int.nit makes more sense with -W to
activate non-lethal runtime warnings.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agonullable: type, compile and test 'isset _attr'
Jean Privat [Wed, 24 Jun 2009 18:44:24 +0000 (14:44 -0400)]
nullable: type, compile and test 'isset _attr'

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agocompile: implicit isset for attribute read access
Jean Privat [Wed, 24 Jun 2009 08:57:45 +0000 (04:57 -0400)]
compile: implicit isset for attribute read access

Activated only if the program was compiled using -W and only display a
warning at run-time.
Therefore the new test base_attr_nullable.nit makes more sense with -W.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agocompile: differentiate attribute read and write
Jean Privat [Wed, 24 Jun 2009 07:22:48 +0000 (03:22 -0400)]
compile: differentiate attribute read and write

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: no isa/as warning for double nullable formal type
Jean Privat [Tue, 23 Jun 2009 21:22:11 +0000 (17:22 -0400)]
syntax: no isa/as warning for double nullable formal type

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agocompile: Check correct object construction
Jean Privat [Tue, 16 Jun 2009 13:45:23 +0000 (09:45 -0400)]
compile: Check correct object construction

Check that non nullable attributes are set at the end of the 'new'.
Activated only if the program was compiled using -W and only display a
warning at run-time.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: extends 'as' and 'isa' warning to nullable
Jean Privat [Thu, 18 Jun 2009 20:45:03 +0000 (16:45 -0400)]
syntax: extends 'as' and 'isa' warning to nullable

Example
  var x: nullable T
  var y = x.as(T) # Bad form
  var y = x.as(not null) # Good form
  if x isa T then ... # Bad form
  if x != null then ... # Good form

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agocompile: casts ('isa' and 'as') with nullable info
Jean Privat [Mon, 15 Jun 2009 20:54:57 +0000 (16:54 -0400)]
compile: casts ('isa' and 'as') with nullable info

Migration remark: considers that non-null objects can still contains null at runtime.

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: base_nullable.nit and base_eq_null_notnull.nit
Jean Privat [Wed, 24 Jun 2009 19:54:22 +0000 (15:54 -0400)]
tests: base_nullable.nit and base_eq_null_notnull.nit

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agosyntax: "!= null" works like a "isa"
Jean Privat [Tue, 23 Jun 2009 17:48:46 +0000 (13:48 -0400)]
syntax: "!= null" works like a "isa"

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotyping: warn when comparing null and not nullable
Jean Privat [Sat, 13 Jun 2009 04:42:08 +0000 (00:42 -0400)]
typing: warn when comparing null and not nullable

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotests: nullable and array
Jean Privat [Mon, 15 Jun 2009 09:13:23 +0000 (05:13 -0400)]
tests: nullable and array

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agotyping: 'for' iterates on Collection[nullable Object]
Jean Privat [Fri, 12 Jun 2009 20:45:40 +0000 (16:45 -0400)]
typing: 'for' iterates on Collection[nullable Object]

Signed-off-by: Jean Privat <jean@pryen.org>

14 years agonullable: type, compile and test 'as(not null)'
Jean Privat [Fri, 12 Jun 2009 14:59:28 +0000 (10:59 -0400)]
nullable: type, compile and test 'as(not null)'

Signed-off-by: Jean Privat <jean@pryen.org>