nit.git
11 years agobench: add bench_typetest_languages
Jean Privat [Sun, 16 Dec 2012 04:23:46 +0000 (23:23 -0500)]
bench: add bench_typetest_languages

this should move to its own directory.

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

11 years agonitg: add GlobalCompiler::new_file
Jean Privat [Sun, 16 Dec 2012 02:22:28 +0000 (21:22 -0500)]
nitg: add GlobalCompiler::new_file

The point is to avoid contamination between must-be-compiled-separately files

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

11 years agomodel: semi-fixed bounds for VirtualType
Jean Privat [Sat, 15 Dec 2012 15:22:53 +0000 (10:22 -0500)]
model: semi-fixed bounds for VirtualType

This mainly allows to get ride of VT in primitive classes
or bounded to primitive classes.

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

11 years agotests: forgot to add base_gen_variance2.nit
Jean Privat [Fri, 14 Dec 2012 22:22:36 +0000 (17:22 -0500)]
tests: forgot to add base_gen_variance2.nit

commit c5363a7de49a97a2b4197312730e6f3358ac0b36 only has the sav/ files

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

11 years agobench: add --fast and reorganize bench
Jean Privat [Fri, 14 Dec 2012 22:21:53 +0000 (17:21 -0500)]
bench: add --fast and reorganize bench

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

11 years agoshoot: add option for headless run
Jean Privat [Fri, 14 Dec 2012 22:05:30 +0000 (17:05 -0500)]
shoot: add option for headless run

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

11 years agobenchs: add bench_policy
Jean Privat [Fri, 14 Dec 2012 21:46:30 +0000 (16:46 -0500)]
benchs: add bench_policy

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

11 years agonitg-s: skip some easy-case tests
Jean Privat [Fri, 14 Dec 2012 21:27:57 +0000 (16:27 -0500)]
nitg-s: skip some easy-case tests

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

11 years agonitg: add option --typing-test-metrics
Jean Privat [Fri, 14 Dec 2012 21:27:29 +0000 (16:27 -0500)]
nitg: add option --typing-test-metrics

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

11 years agonitg: shortcut 'for' loops on explicit ranges
Jean Privat [Fri, 14 Dec 2012 04:45:18 +0000 (23:45 -0500)]
nitg: shortcut 'for' loops on explicit ranges

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

11 years agonitg: autoadapt expression on exit
Jean Privat [Fri, 14 Dec 2012 04:40:47 +0000 (23:40 -0500)]
nitg: autoadapt expression on exit

This avoid to loose static information.

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

11 years agonitg: protect for additional arguments
Jean Privat [Fri, 14 Dec 2012 04:38:42 +0000 (23:38 -0500)]
nitg: protect for additional arguments

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

11 years agotests: add base_gen_variance2.nit
Jean Privat [Fri, 14 Dec 2012 02:45:25 +0000 (21:45 -0500)]
tests: add base_gen_variance2.nit

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

11 years agonitg: use GC_MALLOC_ATOMIC for calloc_string
Jean Privat [Thu, 13 Dec 2012 18:47:23 +0000 (13:47 -0500)]
nitg: use GC_MALLOC_ATOMIC for calloc_string

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

11 years agonitg-s: shortcut the == invocation
Jean Privat [Thu, 13 Dec 2012 17:11:52 +0000 (12:11 -0500)]
nitg-s: shortcut the == invocation

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

11 years agonitg-s: fix opt_generic_tree with opt_hardening
Jean Privat [Thu, 13 Dec 2012 16:06:41 +0000 (11:06 -0500)]
nitg-s: fix opt_generic_tree with opt_hardening

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

11 years agofix opt_no_union_attribute
Jean Privat [Thu, 13 Dec 2012 17:09:07 +0000 (12:09 -0500)]
fix opt_no_union_attribute

11 years agonitg-s&e: implements attributes in a C union
Jean Privat [Thu, 13 Dec 2012 18:48:36 +0000 (13:48 -0500)]
nitg-s&e: implements attributes in a C union

Pro: This give a gain up to 20% in benchs.

Con: isset is broken on primitive attributes.

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

11 years agotests: nitg-s can bootstrap!
Jean Privat [Tue, 11 Dec 2012 22:10:41 +0000 (17:10 -0500)]
tests: nitg-s can bootstrap!

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

11 years agotests: add base_formal_isa
Jean Privat [Wed, 12 Dec 2012 05:26:17 +0000 (00:26 -0500)]
tests: add base_formal_isa

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

11 years agotests: add base_vararg2.nit
Jean Privat [Wed, 12 Dec 2012 05:17:18 +0000 (00:17 -0500)]
tests: add base_vararg2.nit

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

11 years agonitg: better creation of varargs instances
Jean Privat [Wed, 12 Dec 2012 05:12:45 +0000 (00:12 -0500)]
nitg: better creation of varargs instances

FIXME: bogus covariance must be dealt with

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

11 years agoniti: *_class_name use the full type name
Jean Privat [Wed, 12 Dec 2012 05:13:36 +0000 (00:13 -0500)]
niti: *_class_name use the full type name

So tit behave the same way than the non erasure engines.

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

11 years agonitg-s: add hardening on initialization
Jean Privat [Tue, 11 Dec 2012 22:08:52 +0000 (17:08 -0500)]
nitg-s: add hardening on initialization

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

11 years agonitg-s: implements unanchored_table correctly
Jean Privat [Tue, 11 Dec 2012 22:07:42 +0000 (17:07 -0500)]
nitg-s: implements unanchored_table correctly

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

11 years agonitg-s: implements calloc_array by calling native_array_instance
Jean Privat [Tue, 11 Dec 2012 22:05:23 +0000 (17:05 -0500)]
nitg-s: implements calloc_array by calling native_array_instance

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

11 years agonitg-s: remove superfluous autobox
Jean Privat [Tue, 11 Dec 2012 16:43:01 +0000 (11:43 -0500)]
nitg-s: remove superfluous autobox

A function type_info is introduced to uniformize the access to
a type structure.

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

11 years agonitg-s: add primitive types to the set of mtypes
Jean Privat [Tue, 11 Dec 2012 17:29:17 +0000 (12:29 -0500)]
nitg-s: add primitive types to the set of mtypes

This will allow static designation of related structures to be compilable.

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

11 years agonitg-s: rename fields Xts to types to be consistant with the abstract struct
Jean Privat [Tue, 11 Dec 2012 16:35:42 +0000 (11:35 -0500)]
nitg-s: rename fields Xts to types to be consistant with the abstract struct

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

11 years agonitg: disable Boehm's GC by defining the macro NOBOEHM
Jean Privat [Tue, 11 Dec 2012 05:57:46 +0000 (00:57 -0500)]
nitg: disable Boehm's GC by defining the macro NOBOEHM

From a command line point of view, one can use

   nitg --make-flags "CFLAGS=\"-O2 -DNOBOEHM\"" myprog.nit

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

11 years agobench: compare nitg-e with various compiler and -O values
Jean Privat [Tue, 11 Dec 2012 05:28:37 +0000 (00:28 -0500)]
bench: compare nitg-e with various compiler and -O values

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

11 years agonitg: add option --make-flags to pass options to make
Jean Privat [Tue, 11 Dec 2012 05:28:06 +0000 (00:28 -0500)]
nitg: add option --make-flags to pass options to make

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

11 years agobench: add bench_nitc_vc_nitg
Jean Privat [Tue, 11 Dec 2012 03:40:12 +0000 (22:40 -0500)]
bench: add bench_nitc_vc_nitg

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

11 years agobench: replace shootout_binarytrees with bench_bintree_gen
Jean Privat [Tue, 11 Dec 2012 03:18:18 +0000 (22:18 -0500)]
bench: replace shootout_binarytrees with bench_bintree_gen

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

11 years agotests: add bench_bintree_gen
Jean Privat [Tue, 11 Dec 2012 03:18:01 +0000 (22:18 -0500)]
tests: add bench_bintree_gen

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

11 years agotests: base_gen_reassign.nit
Jean Privat [Tue, 11 Dec 2012 02:33:27 +0000 (21:33 -0500)]
tests: base_gen_reassign.nit

This test basically fails on every engine :(
So no sav/ files for the moment.

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

11 years agotests: add a timeout limit to avoid blocked programs
Jean Privat [Tue, 11 Dec 2012 02:30:56 +0000 (21:30 -0500)]
tests: add a timeout limit to avoid blocked programs

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

11 years agonitg-s&e: store class_names directly in the type/class structures
Jean Privat [Sun, 9 Dec 2012 05:13:25 +0000 (00:13 -0500)]
nitg-s&e: store class_names directly in the type/class structures

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

11 years agonitg-e: make HASH a macro, not a function
Jean Privat [Mon, 10 Dec 2012 21:20:00 +0000 (16:20 -0500)]
nitg-e: make HASH a macro, not a function

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

11 years agobenchs: add nitg-s to benchs
Jean Privat [Mon, 10 Dec 2012 21:12:04 +0000 (16:12 -0500)]
benchs: add nitg-s to benchs

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

11 years agobench: factorize some benchs
Jean Privat [Mon, 10 Dec 2012 03:32:57 +0000 (22:32 -0500)]
bench: factorize some benchs

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

11 years agonitg-s&e: compile module in local knowledge
Jean Privat [Mon, 10 Dec 2012 02:29:56 +0000 (21:29 -0500)]
nitg-s&e: compile module in local knowledge

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

11 years agoMerge remote-tracking branch 'alexandre/master'
Jean Privat [Mon, 10 Dec 2012 20:53:57 +0000 (15:53 -0500)]
Merge remote-tracking branch 'alexandre/master'

11 years agonitg-e: avoid automatic boxing in vt resolution
Alexandre Terrasa [Sun, 9 Dec 2012 22:10:36 +0000 (17:10 -0500)]
nitg-e: avoid automatic boxing in vt resolution

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s/-e: avoid compilation of emtpy vt/ft/unanchored structs.
Alexandre Terrasa [Sun, 9 Dec 2012 22:08:35 +0000 (17:08 -0500)]
nitg-s/-e: avoid compilation of emtpy vt/ft/unanchored structs.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s: merged fts, vts and unanchored struct types representations.
Alexandre Terrasa [Sun, 9 Dec 2012 21:17:51 +0000 (16:17 -0500)]
nitg-s: merged fts, vts and unanchored struct types representations.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s: reorder struct type fields
Alexandre Terrasa [Sun, 9 Dec 2012 21:05:23 +0000 (16:05 -0500)]
nitg-s: reorder struct type fields

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s: introduce unanchored resolution tables.
Alexandre Terrasa [Sun, 9 Dec 2012 20:59:24 +0000 (15:59 -0500)]
nitg-s: introduce unanchored resolution tables.

Unanchored resolution tables allow the compiler to retrieve at runtime a live generic type with given formal types
Old tree based resolution structure with tree is now an option of nitg (--generic-resolution-tree)

Options --bm-typing and --ph*-typing affects the unanchored tables generations.

Updated nitg.res with new option. Also added tests in makefile.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agoMerge remote-tracking branch 'alexandre/master'
Jean Privat [Sun, 9 Dec 2012 06:38:43 +0000 (01:38 -0500)]
Merge remote-tracking branch 'alexandre/master'

11 years agotests: add test_array_formal.nit
Jean Privat [Sun, 9 Dec 2012 05:33:26 +0000 (00:33 -0500)]
tests: add test_array_formal.nit

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

11 years agotests: add base_virtual_type_variance.nit
Jean Privat [Sun, 9 Dec 2012 05:31:13 +0000 (00:31 -0500)]
tests: add base_virtual_type_variance.nit

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

11 years agotests: add base_attr_boxing.nit
Jean Privat [Sun, 9 Dec 2012 05:24:53 +0000 (00:24 -0500)]
tests: add base_attr_boxing.nit

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

11 years agonitg-e: add option --no-check-erasure-cast to disable erasure-casts
Jean Privat [Sun, 9 Dec 2012 03:58:25 +0000 (22:58 -0500)]
nitg-e: add option --no-check-erasure-cast to disable erasure-casts

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

11 years agonitg-e: implements erasure-cast
Jean Privat [Sun, 9 Dec 2012 03:40:59 +0000 (22:40 -0500)]
nitg-e: implements erasure-cast

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

11 years agotyping: add CallSite::erasure_cast to indicate if a cast may be required
Jean Privat [Sun, 9 Dec 2012 03:37:38 +0000 (22:37 -0500)]
typing: add CallSite::erasure_cast to indicate if a cast may be required

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

11 years agonitg: add v.compile_callsite to generate the send associated to a CallSite instances
Jean Privat [Sun, 9 Dec 2012 03:36:50 +0000 (22:36 -0500)]
nitg: add v.compile_callsite to generate the send associated to a CallSite instances

The point of this method is to extends the CallSite concept
to the compiler.

A future commit will redefine compile_callsite method to add erasure-casts.

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

11 years agotyping: attach CallSite instances to AST nodes
Jean Privat [Sun, 9 Dec 2012 03:26:58 +0000 (22:26 -0500)]
typing: attach CallSite instances to AST nodes

Instead of having some partial information, just attach the whole thing.
Previous partial information is tagged @depreciated

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

11 years agonitg-s: retrieve recursively all partial generic types
Alexandre Terrasa [Sun, 9 Dec 2012 01:25:43 +0000 (20:25 -0500)]
nitg-s: retrieve recursively all partial generic types

for new G[H[nullable T], Object] and T: X
nitg-s will now find :
G[H[nullable X], Object]
H[nullable X]
nullable X
Object
as type to generate.

H[nullable X] and nullable X are considered as partial type because they are only used as part of a generic livetype.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agotyping: new class CallSite
Jean Privat [Sun, 9 Dec 2012 01:24:07 +0000 (20:24 -0500)]
typing: new class CallSite

This class is used to combine information on a specific call site.

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

11 years agonitg-s: add cast to remove c warnings
Alexandre Terrasa [Sun, 9 Dec 2012 00:28:07 +0000 (19:28 -0500)]
nitg-s: add cast to remove c warnings

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agobenchs: add entry for nitg-e with inline colors, bm, phmod and phand
Alexandre Terrasa [Sat, 8 Dec 2012 23:29:28 +0000 (18:29 -0500)]
benchs: add entry for nitg-e with inline colors, bm, phmod and phand

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agotests: add goals in makefile for nitg-s/-e with --bm-typing --phmod-typing and -...
Alexandre Terrasa [Sat, 8 Dec 2012 23:18:24 +0000 (18:18 -0500)]
tests: add goals in makefile for nitg-s/-e with --bm-typing --phmod-typing and --phand-typing

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agotests: update option list for nitg, nitg-s & nitg-e
Alexandre Terrasa [Sat, 8 Dec 2012 23:12:10 +0000 (18:12 -0500)]
tests: update option list for nitg, nitg-s & nitg-e

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agocoloring: replace static bound of OrderedSet[nullable Object] with Object
Alexandre Terrasa [Sat, 8 Dec 2012 23:11:30 +0000 (18:11 -0500)]
coloring: replace static bound of OrderedSet[nullable Object] with Object

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s/-e: rename c variable "type" in body function to avoid conflicts with paramete...
Alexandre Terrasa [Sat, 8 Dec 2012 22:56:18 +0000 (17:56 -0500)]
nitg-s/-e: rename c variable "type" in body function to avoid conflicts with parameter names

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agoMerge remote-tracking branch 'github-privat/master'
Alexandre Terrasa [Sat, 8 Dec 2012 22:12:13 +0000 (17:12 -0500)]
Merge remote-tracking branch 'github-privat/master'

11 years agonitg-s: introduce formal type perfect hashing
Alexandre Terrasa [Sat, 8 Dec 2012 21:39:09 +0000 (16:39 -0500)]
nitg-s: introduce formal type perfect hashing

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s/-e: introduce virtual type perfect hashing
Alexandre Terrasa [Sat, 8 Dec 2012 21:07:11 +0000 (16:07 -0500)]
nitg-s/-e: introduce virtual type perfect hashing

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s: limit table access by factoring c code
Alexandre Terrasa [Sat, 8 Dec 2012 07:02:43 +0000 (02:02 -0500)]
nitg-s: limit table access by factoring c code

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s: instantiate the right array in case of unresolved elttype
Jean Privat [Sat, 8 Dec 2012 05:56:58 +0000 (00:56 -0500)]
nitg-s: instantiate the right array in case of unresolved elttype

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

11 years agonitg-s/-e: make typing related option names simpler
Alexandre Terrasa [Sat, 8 Dec 2012 05:26:45 +0000 (00:26 -0500)]
nitg-s/-e: make typing related option names simpler

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s: option --use-naive-coloring now affects FT, VT and livegen fabrics coloring
Alexandre Terrasa [Sat, 8 Dec 2012 05:19:11 +0000 (00:19 -0500)]
nitg-s: option --use-naive-coloring now affects FT, VT and livegen fabrics coloring

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s/-e: always use coloration for attributes and methods are always
Alexandre Terrasa [Sat, 8 Dec 2012 05:17:44 +0000 (00:17 -0500)]
nitg-s/-e: always use coloration for attributes and methods are always

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s: allocate HashSet[MType] for conflicts_graph_cache
Jean Privat [Sat, 8 Dec 2012 03:05:27 +0000 (22:05 -0500)]
nitg-s: allocate HashSet[MType] for conflicts_graph_cache

A covariant cast error is raised by non-buggy engines when
a MNullableType object is added into a Set[MType] that is
dynamically a HashSet[MClassType].

Instantiate HashSet[MType] instead of HashSet[MClassType] remove
the cast error.

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

11 years agobench: split and specialize "options" benchs
Jean Privat [Fri, 7 Dec 2012 22:18:04 +0000 (17:18 -0500)]
bench: split and specialize "options" benchs

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

11 years agobench: do not crash on die, just flag the failed command
Jean Privat [Fri, 7 Dec 2012 22:13:28 +0000 (17:13 -0500)]
bench: do not crash on die, just flag the failed command

This will make bigtests tests other benchs.

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

11 years agotests: upgrade nitg-s to *.nit
Jean Privat [Fri, 7 Dec 2012 22:10:55 +0000 (17:10 -0500)]
tests: upgrade nitg-s to *.nit

There is still an unknown breakage on nit_args1 :/

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

11 years agonitg: do not compile main during the instantiation
Jean Privat [Sat, 8 Dec 2012 02:05:24 +0000 (21:05 -0500)]
nitg: do not compile main during the instantiation

main requires `init` and `send`, thus it is preferable to
wait that basic structures or whatever are built.

For instance, the new behavior fixes --hardering with nitg.

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

11 years agonitg-s/-e: add option --use-*-perfect-hashing
Alexandre Terrasa [Sat, 8 Dec 2012 00:15:47 +0000 (19:15 -0500)]
nitg-s/-e: add option --use-*-perfect-hashing

Coloration can be replaced by perfect hashing for subtyping tests.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agoMerge remote branch 'alexandre/master'
Jean Privat [Fri, 7 Dec 2012 21:15:04 +0000 (16:15 -0500)]
Merge remote branch 'alexandre/master'

11 years agotests: add base_autocast.nit
Jean Privat [Fri, 7 Dec 2012 21:10:40 +0000 (16:10 -0500)]
tests: add base_autocast.nit

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

11 years agonitg: implements implicit casts for unsafe nexpr
Jean Privat [Fri, 7 Dec 2012 20:25:38 +0000 (15:25 -0500)]
nitg: implements implicit casts for unsafe nexpr

add the option --no-check-autocast to disable it.

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

11 years agotests: declare Bool to base_types_nullable_formal_and_virtual
Jean Privat [Fri, 7 Dec 2012 21:09:33 +0000 (16:09 -0500)]
tests: declare Bool to base_types_nullable_formal_and_virtual

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

11 years agotests: fix test_attr_easy.res for the new model.
Jean Privat [Fri, 7 Dec 2012 20:51:43 +0000 (15:51 -0500)]
tests: fix test_attr_easy.res for the new model.

Commit d2992803b added a space in the representation of generic types,
thus changed an error message.

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

11 years agoniti: implements implicit casts for unsafe nexpr
Jean Privat [Fri, 7 Dec 2012 20:03:49 +0000 (15:03 -0500)]
niti: implements implicit casts for unsafe nexpr

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

11 years agotyping: new attribute AExpr::implicit_cast_to
Jean Privat [Fri, 7 Dec 2012 20:01:01 +0000 (15:01 -0500)]
typing: new attribute AExpr::implicit_cast_to

If required, the following implicit cast ".as(XXX)"
Such a cast may by required after evaluating the expression when
a unsafe operation is detected (silently accepted by the Nit language).

The attribute is computed by `check_subtype`

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

11 years agotyping: the return of check_subtype can distinguish safety and unsafely.
Jean Privat [Fri, 7 Dec 2012 19:26:38 +0000 (14:26 -0500)]
typing: the return of check_subtype can distinguish safety and unsafely.

Thus visit_expr_subtype can return the correct type
as if an implicit cast was added.

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

11 years agolib: fix ArrayMapValues::first
Jean Privat [Fri, 7 Dec 2012 06:54:47 +0000 (01:54 -0500)]
lib: fix ArrayMapValues::first

Thanks to the new MType::is_subtype test, bugs like these can be spotted.

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

11 years agomodel: rewrite of MType::is_subtype
Jean Privat [Fri, 7 Dec 2012 06:53:26 +0000 (01:53 -0500)]
model: rewrite of MType::is_subtype

The previous writing was just wrong.
Mainly because the two first `resolve_for` always lost the parameter types.
But the rest of the method was also overly complex and buggy.

Note that the fixed behavior make a test pass because of the
"FIXME workaround" in typing.nit

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

11 years agonitg: refactoring
Alexandre Terrasa [Fri, 7 Dec 2012 05:51:21 +0000 (00:51 -0500)]
nitg: refactoring

No more intrude include import of  coloring
Change blocks from run_global_compiler as new services of GlobalCompiler to nitg for better code reuse in subclasses
* compile header
* compile class names
Rename some functions from generate_ to compile_ for more uniform naming

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agolib: rewrite Collection::rand without explicit closure
Jean Privat [Thu, 6 Dec 2012 06:06:28 +0000 (01:06 -0500)]
lib: rewrite Collection::rand without explicit closure

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

11 years agotests: test equality on Float
Jean Privat [Thu, 6 Dec 2012 14:59:08 +0000 (09:59 -0500)]
tests: test equality on Float

The point is that some floats are equal even if the bit representation
differs. This helps to illustrate bad implementation of floats.

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

11 years agotests: add base_attr_init_val_raf.nit
Jean Privat [Thu, 6 Dec 2012 00:43:32 +0000 (19:43 -0500)]
tests: add base_attr_init_val_raf.nit

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

11 years agotests: add base_gen_variance.nit
Jean Privat [Thu, 6 Dec 2012 00:26:04 +0000 (19:26 -0500)]
tests: add base_gen_variance.nit

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

11 years agonitg-s/-e: Add option --use-naive-coloring
Alexandre Terrasa [Thu, 6 Dec 2012 21:05:18 +0000 (16:05 -0500)]
nitg-s/-e: Add option --use-naive-coloring

When enabled, this option replace standard coloring by a naive one allowing the compiler to simulate binary matrix type representation.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-e: change empty slots representation in vt tables to avoid C warning in sparse...
Alexandre Terrasa [Thu, 6 Dec 2012 20:28:08 +0000 (15:28 -0500)]
nitg-e: change empty slots representation in vt tables to avoid C warning in sparse tables.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg: fix tests/sav/nitg with new options added in nitg-s
Alexandre Terrasa [Thu, 6 Dec 2012 20:27:20 +0000 (15:27 -0500)]
nitg: fix tests/sav/nitg with new options added in nitg-s

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s: add --inline-coloring-numbers option
Alexandre Terrasa [Thu, 6 Dec 2012 06:59:09 +0000 (01:59 -0500)]
nitg-s: add --inline-coloring-numbers option

With this option activated nitg-s use #define to inline coloring numbers.
Without, nitg-s use const.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s/-e: refactor property coloring for use of #define
Alexandre Terrasa [Thu, 6 Dec 2012 06:27:45 +0000 (01:27 -0500)]
nitg-s/-e: refactor property coloring for use of #define

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

11 years agonitg-s: rename SeparateCompiler:do_global_type_coloring to do_type_coloring
Alexandre Terrasa [Thu, 6 Dec 2012 06:25:40 +0000 (01:25 -0500)]
nitg-s: rename SeparateCompiler:do_global_type_coloring to do_type_coloring

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>