Jean Privat [Fri, 10 Oct 2014 02:09:12 +0000 (22:09 -0400)]
mixin: introduce -D option to redefine functions from the command-line
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 10 Oct 2014 02:07:03 +0000 (22:07 -0400)]
src: new module mixin to factorize the -m option
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 10 Oct 2014 02:05:26 +0000 (22:05 -0400)]
compiler: do not use the outnames of fictive modules
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 10 Oct 2014 02:04:50 +0000 (22:04 -0400)]
toolcontext: introduce ToolContext::make_main_module
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 10 Oct 2014 01:49:22 +0000 (21:49 -0400)]
compiler: add Visitor::bool_instance
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 10 Oct 2014 01:46:32 +0000 (21:46 -0400)]
modelbuilder: node is optionnal in Modelbuilder::force_get_primitive_method
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 10 Oct 2014 00:21:01 +0000 (20:21 -0400)]
engines: do not crash on AST-less mclassdef
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 10 Oct 2014 00:19:37 +0000 (20:19 -0400)]
interpreter: add Interpreter::string_instance
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 9 Oct 2014 03:32:01 +0000 (23:32 -0400)]
Merge: Tester over MPI
On turing, running `mpirun -np 120 ../nitester --engine nitg-s,nitg-g,nitg-sg,nitg-e,niti ../src/nit*.nit ../examples/*.nit *.nit` from the `tests` directory takes 2m 46s on 120 processors to evaluate 9003 programs/engine combinations. On a single processor, the same work takes over 2 hours.
# Results (for the execution specified above)
* 9003 total test programs
* 5728 oks & 0ks
* 1245 fails (a lot of libraries and SDKs are missing)
* 175 no savs
* 191 fixmes
* 1494 sosos
* 125 skips
* 45 unknowns (unsupported results: skip soso, changed, etc.)
# Features and todo
- [x] Uses OpenMPI
- [x] Supports all engines through tests.sh
- [x] Collects and classify results
- [x] Works on the Turing cluster
- [x] Optimized to avoid overloading NFS
- [ ] Correctly detect the all the results (no more unknowns)
- [ ] Use with Jenkins (see what we can do with the generated XML files)
- [ ] Gather and keep failed results temporary files
- [ ] Be more customizable to run on different clusters
- [ ] Integrate some features from tests.sh
Pull-Request: #807
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Wed, 8 Oct 2014 22:00:25 +0000 (18:00 -0400)]
Merge: Opportunity
Intoducing Opportunity, a Meetup planifier (or planner, if we listen to @xymus, will correct that along with your remarks).
So, here's the long awaited Opportunity that will be the cornerstone of every ~~nutritious breakfast~~ Latece weekly seminar.
Maybe more once finished, let's conquer the world with Nit's amazing abilities for easy web development.
Also, a function was missing from SQLite, I needed it so, here it is as well.
Pull-Request: #796
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 4 Jul 2014 16:01:31 +0000 (12:01 -0400)]
contrib: intro nitester, a tester of Nit engines using MPI
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Wed, 8 Oct 2014 17:30:56 +0000 (13:30 -0400)]
Merge: Can refine inits
Bugfix where a redefined init constructor in a refined class loses its initializers.
This is a fast fix. A cleaner and more generalized approach may be developed latter.
Reported-by: Alexis Laferrière <alexis.laf@xymus.net>
Pull-Request: #810
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Tue, 7 Oct 2014 18:00:48 +0000 (14:00 -0400)]
tests: add base_init_auto_refine
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 7 Oct 2014 18:00:11 +0000 (14:00 -0400)]
modelize_property: inherit the initializers in the refinements of init
Signed-off-by: Jean Privat <jean@pryen.org>
Lucas Bajolet [Wed, 8 Oct 2014 14:54:41 +0000 (10:54 -0400)]
jenkins: Added opportunity to Jenkins paths
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 7 Oct 2014 14:19:04 +0000 (10:19 -0400)]
opportunity: Added Makefile and README
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 30 Sep 2014 20:24:19 +0000 (16:24 -0400)]
contrib/opportunity: Added tests for opportunity
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Mon, 29 Sep 2014 21:19:49 +0000 (17:19 -0400)]
contrib: Intro Opportunity, a meetup planner in Nit
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Tue, 7 Oct 2014 12:35:12 +0000 (08:35 -0400)]
Merge: nitunit: accept an absolute path for `--dir`.
When I passed an absolute path to the `--dir` option of `nitunit`, I got errors like this one:
```
ERROR: test_unread_order (in file /my/costum/dir/.nitunit/test_push_back_reader_TestPushBackDecorator_test_unread_order.nit): sh: 1: .//my/costum/dir/.nitunit/test_push_back_reader_TestPushBackDecorator_test_unread_order.bin: not found
```
It was a trivial bug so I fixed this.
Pull-Request: #809
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Tue, 7 Oct 2014 12:35:09 +0000 (08:35 -0400)]
Merge: lib/math: Added bin_not function to Int
Added missing function bin_not to `Int` as I might need it in the near future.
I figured it could be needed by someone else, so why not !
Pull-Request: #806
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean-Christophe Beaupré [Mon, 6 Oct 2014 16:22:28 +0000 (12:22 -0400)]
nitunit: accept an absolute path for `--dir`.
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Lucas Bajolet [Mon, 6 Oct 2014 21:11:08 +0000 (17:11 -0400)]
lib/standard/math: Fixed documentation on old binary operators
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Mon, 6 Oct 2014 19:46:00 +0000 (15:46 -0400)]
Merge: stream: push-back reader
I implemented something similar to http://docs.oracle.com/javase/7/docs/api/java/io/PushbackReader.html last week thinking I needed it for the XML parser, but I ended up with a top-down parser that do not need to backtrack by more than one octet.
Pull-Request: #805
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Mon, 6 Oct 2014 19:45:57 +0000 (15:45 -0400)]
Merge: NOTICE: update dates and authors.
After 2 years, I think the `NOTICE` file need to be updated.
Pull-Request: #804
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean-Christophe Beaupré [Fri, 3 Oct 2014 14:38:34 +0000 (10:38 -0400)]
stream: Introduce a push-back reader.
May be useful when implementing backtracking algorithms.
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Lucas Bajolet [Mon, 6 Oct 2014 15:23:04 +0000 (11:23 -0400)]
lib/nitcorn: HttpRequest added methods to get an argument of a certain type
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Lucas Bajolet [Tue, 30 Sep 2014 20:25:04 +0000 (16:25 -0400)]
lib/sqlite: Added last_rowid method to SQLite
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Jean-Christophe Beaupré [Fri, 3 Oct 2014 13:34:24 +0000 (09:34 -0400)]
NOTICE: update dates and authors.
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Jean Privat [Mon, 6 Oct 2014 14:10:59 +0000 (10:10 -0400)]
Merge: Improve Comparator type-kindness
The Comparator class in Nit was a PITA because, with the traditional modelization with a generic class, Comparator is contravariant but Nit only allows covariance in its genericity.
Example:
~~~nit
var ao = new Array[Object].with_items(2,1,10)
ao.sort_with(alpha_comparator)
print ao.join(" ") # => 1 10 2
var ai = new Array[Int].with_items(2,1,10)
ai.sort_with(alpha_comparator)
# Static error: expected a Comparator[Int], got a Comparator[Object]
~~~
This PR implements the nice proposition of Etienne Gagnon to makes Comparator a non-generic class but use virtual types to control the type of compared elements.
It is clearly an improvement over the previous implementation:
* more expressive (++++)
* less code (+)
* simpler for the client (less generic stuff) (+)
* coherent with the `Comparable` hierarchy that also use virtual types (+)
* a little more complex for the lib (virtual type redefinition) (-)
* loss of information when things are typed with the interface `Comparator`, yielding to more potential covariance error at runtime (--)
While less type-safe than a full (and complex) contravariance solution, the proposed solution is still better in term of type-safety than dynamic languages and non-generic-non-virtual-type solutions (eg. Java4):
* runtime errors are detected earlier than with erasure or with dynamic typing (fail fast)
* some errors are still detected statically:
~~~
var a = [1,10,2,3]
alpha_comparator.sort(a)
print a.join(" ") #=> 1 10 2 3
default_comparator.sort(a)
print a.join(" ") #=> 1 2 3 10
var b = [true, false]
alpha_comparator.sort(b)
print b.join(" ") # => false true
default_comparator.sort(b)
# Static type error: expected Array[Comparable], got Array[Bool]
~~~
Original-Idea-By: Etienne M. Gagnon <egagnon@j-meg.com>
Pull-Request: #803
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexis Laferrière [Thu, 2 Oct 2014 03:04:24 +0000 (23:04 -0400)]
tests.sh: add env var to move xml file
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 1 Oct 2014 17:02:06 +0000 (13:02 -0400)]
tests.sh: allow errlist file inside outdir
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 1 Oct 2014 16:51:15 +0000 (12:51 -0400)]
tests.sh: add -node option
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 3 Oct 2014 21:32:33 +0000 (17:32 -0400)]
tests.sh: remove --quiet option on calls to time
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 1 Oct 2014 16:09:09 +0000 (12:09 -0400)]
tests.sh: support absolute path to outdir
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 1 Oct 2014 15:39:00 +0000 (11:39 -0400)]
tests.sh: add options outdir and compdir to tests.sh script
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 3 Oct 2014 16:05:07 +0000 (12:05 -0400)]
tests.sh: fix reference to /dev/null
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 3 Oct 2014 15:51:38 +0000 (11:51 -0400)]
lib/signals: improve documentation
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Lucas Bajolet [Fri, 3 Oct 2014 15:46:07 +0000 (11:46 -0400)]
lib/math: Added bin_not function to Int
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Jean-Christophe Beaupré [Fri, 3 Oct 2014 14:23:59 +0000 (10:23 -0400)]
stream: Offer string-backed input streams.
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Jean Privat [Thu, 2 Oct 2014 19:11:57 +0000 (15:11 -0400)]
model: rename LinexComparator::min/max to avoid name conflicts
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 2 Oct 2014 17:32:49 +0000 (13:32 -0400)]
lib: beef-up the Comparator api and documentation
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 2 Oct 2014 17:14:24 +0000 (13:14 -0400)]
lib: new API for Comparator
Also remove old deprecated classes.
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 2 Oct 2014 01:28:40 +0000 (21:28 -0400)]
Merge: lib: move some examples/* into specific subdirectories of their lib
examples/ starts to become a mess.
So move the simple examples of lib into an `example` subdirectory of the lib.
But I am not really sure that it is a good idea.
Before: 132 projects, now 120 projects.
Pull-Request: #793
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Thu, 2 Oct 2014 01:28:31 +0000 (21:28 -0400)]
Merge: Niti: small refactoring
Some small improvements in the interpreter code infrastructure.
Pull-Request: #801
Jean Privat [Thu, 2 Oct 2014 00:13:18 +0000 (20:13 -0400)]
Merge: Niti loves the command line
Nit is both a good compiled language and a good interpreted language (except that the naive interpreter is slow).
Some people already use nit as a traditional script-language by including a shebang at the first line of their programs and set them executable (`chmod +x`).
~~~nit
print "Hello world"
~~~
This experimental PR make the nit interpreter more script-useful.
First, it introduces the `-e` option to run a program written on the command line.
Like with ruby, perl, bash and other script language.
~~~sh
$ nit -e 'print 5+5'
10
~~~
Second, and this is just wonderful, it adds the `-n` option (from ruby and perl) to automatically iterate over the lines of files given as arguments. The current line is named `sys.line` (instead of `$_` in perl and ruby).
It works for stdin if no argument
~~~sh
$ echo "hello world" | nit -n -e 'print sys.line.capitalized'
Hello World
~~~
or on the arguments (as files) if one or more is given (it is the perl and ruby semantic)
~~~sh
$ nit -n -e 'print sys.line.capitalized' README
Nit Is A Statically Typed Object-Oriented Programming Language.
The Goal Of Nit Is To Propose A Statically Typed Programming Language Where Structure Is Not A Pain.
[...]
~~~
The logic of the `-n` is written in a library loaded at runtime (`niti_runtime.nit`), so can be updated without having to recompile the interpreter.
Pull-Request: #799
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Wed, 1 Oct 2014 21:18:19 +0000 (17:18 -0400)]
version 0.6.9
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 1 Oct 2014 21:17:06 +0000 (17:17 -0400)]
Merge: modelize: `missing-doc` on attributes
missing-doc only fires on public properties.
But attributes are always Private, so consider the getter method instead.
It make sense since the documentation on an attribute documents more the
getter than the attribute.
Pull-Request: #800
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Wed, 1 Oct 2014 17:40:00 +0000 (13:40 -0400)]
Merge: engines: no more `super_inits` method used in old-style automatic init
Unneeded old code...
Pull-Request: #798
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Wed, 1 Oct 2014 17:39:56 +0000 (13:39 -0400)]
Merge: neo: do not instantiate types directly, use the model API
Since visibility on constructor is disabled in nitg, the errors was not detected.
Pull-Request: #797
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Wed, 1 Oct 2014 17:39:53 +0000 (13:39 -0400)]
Merge: src: reduce warnings and spelling errors
Thanks to the new detected warnings, it is easier to remove them.
Also fix some spelling errors because vim colored them in red.
Pull-Request: #795
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Wed, 1 Oct 2014 17:34:44 +0000 (13:34 -0400)]
niti: change some visibility to avoid unnecessary intrude imports
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 1 Oct 2014 17:33:04 +0000 (13:33 -0400)]
niti: rename `init_naive_interpreter` as `Interpreter::start`
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 1 Oct 2014 14:54:31 +0000 (10:54 -0400)]
niti: introduce `read_variable` and `write_variable`
So the internal map is no more acceded directly, thus opening the door to
a more efficient implementation.
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 1 Oct 2014 13:21:07 +0000 (09:21 -0400)]
modelize: `missing-doc` on attributes
missing-doc only fires on public properties.
But attributes are always Private, so consider the getter method instead.
It make sense since the documentation on an attribute documents more the
getter than the attribute.
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 1 Oct 2014 13:14:41 +0000 (09:14 -0400)]
src: reduce warnings and spelling errors
Thanks to the new detected warnings, it is easier to remove them.
Also fix some spelling errors because vim colored them in red.
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 1 Oct 2014 13:07:08 +0000 (09:07 -0400)]
niti: add -n to run the program for each line in file-name arguments
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 1 Oct 2014 01:26:40 +0000 (21:26 -0400)]
niti: add -e to feed the interpreter with a program on the command line
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 1 Oct 2014 01:34:15 +0000 (21:34 -0400)]
modelbuilder: parent in load_rt_module is optionnal
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 1 Oct 2014 01:24:48 +0000 (21:24 -0400)]
lib/standard: make IFStream a PollableIStream so it can be used as stdin
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 1 Oct 2014 00:13:09 +0000 (20:13 -0400)]
engines: no more `super_inits` method used in old-style automatic init
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 1 Oct 2014 00:01:25 +0000 (20:01 -0400)]
neo: do not instantiatetypes directly, use the model API
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 30 Sep 2014 20:01:08 +0000 (16:01 -0400)]
lib: move some examples/* into specific subdirectories of their lib
examples/ starts to become a mess.
So move the simple examples of lib into an `example` subdirectory of the lib.
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 30 Sep 2014 20:00:08 +0000 (16:00 -0400)]
lib: create directories for some lib (in order to prepare examples)
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 30 Sep 2014 17:23:13 +0000 (13:23 -0400)]
.mailmap: add alias for privat@pryen.org
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 30 Sep 2014 10:51:52 +0000 (06:51 -0400)]
Merge: toolcontext: new option -w to enable/disable warning
The `-w` option takes the name of a warning (displayed at the end of message, between parentheses) to activate it; and "no-{name}" to disable it. It has precedence over -q and -W.
To show only missing-doc warnings in standard
~~~sh
$ nitg -q -w missing-doc standard
~~~
To show all warnings and advices, except missing-doc
~~~sh
$ nitg -W -w no-missing-doc standard
~~~
To show standard warnings except useless-type-test, but not advice except missing-doc
~~~sh
$ nitg -w missing-doc -w no-useless-type-test standard
~~~
Pull-Request: #790
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Tue, 30 Sep 2014 10:49:26 +0000 (06:49 -0400)]
Merge: compiler: compile_dir can be anywhere
Fix an old TODO. Now you can compile where you want and stop having a bunch of fat .nit_compile directories everywhere.
~~~sh
$ nitg --compile-dir /tmp/nit_compile examples/hello_word.nit
~~~
Pull-Request: #789
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Tue, 30 Sep 2014 02:09:46 +0000 (22:09 -0400)]
tests: update sav/test_toolcontext*
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 30 Sep 2014 01:51:44 +0000 (21:51 -0400)]
Merge: new annotation for manual setter `autoinit`
Sometime, automatic setters are not suitable and manual ones should be used.
Nit, especially since annotations (#601 and #604), has a simple way to have attributes and manual setters.
~~~niy
class A
var foo: String is private writable(private_set_foo)
fun foo=(v: String) do ...
end
~~~
However, with new constructor, it is the `private_set_foo` method that is used as initializer during the instantiation.
~~~nit
var a = new A("toto") # is in fact:
# a = alloc-instance(A)
# a.private_set_foo("toto")
# a.init
~~~
One may want to manually promote some setters as initializers, it is the job of the proposed `autoinit` annotation.
~~~nit
class B
var foo: String is private writable(private_set_foo), noinit
fun foo=(v: String) is autoinit do ...
end
var b = new B("toto") # is in fact:
# B = alloc-instance(B)
# b.foo=("toto")
# b.init
~~~
Bonus: in fact, this works for any method, even when they have more than one parameter. See the modification of the clock example that now use new constructors with a manually-set auto-initializer.
Pull-Request: #787
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Tue, 30 Sep 2014 01:51:43 +0000 (21:51 -0400)]
Merge: misc/jenkins: fix checklicense.sh
* Correct documentation.
* Fix the regular expression for the sought comment.
Fixes #780.
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Pull-Request: #786
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 30 Sep 2014 01:51:39 +0000 (21:51 -0400)]
Merge: Fix generic parameter names
Since the beginning of Nit and class refinement, formal parameter names were attached to local-classes (MClassDef). So giving the ability to use different names in various class refinements.
This was done in an analogous way with parameters in methods since one can change their names in redefinitions or methods.
Nowadays, I think it is a nonoptimal idea since this renaming ability is unused, worse it is considered bad since it makes code more complex to read: one do not want to have distinct vocabulary for the same class but in distinct modules.
Moreover, having parameters attached to the class but names attached to the classdef cause some meta-model nightmares and a workaround was to internally name parameters with their rank in the class.
But nobody liked error message like `got Foo#0 but expected Bar#2`
A last issue is that, for a dynamic type system point of view, the formal types can be exposed as object-oriented-services. For instance, in potential construction like `if x isa y.T then ...`, where `T` is a formal type defined in the static class of `y`, and that will be resolved at runtime.
Thus, it is a bad idea that names of services can vary through refinement.
Therefore, this PR moves the name of generic formal parameters in `MParameterType`, kill the ugly `MClassDef::parameter_names`, rationalize `MClass` and `MClassDef` construction, and update all the client code.
This PR gives also two bonuses:
* `name` and `to_s` in `MParameterType` make sense so type-related error messages are more readable.
* Since the names of formal parameters become invariant in refinements, their declaration become optional:
~~~.nit
redef class Array # no E declared here
fun pushshift(e: E):E do # but used here
add(e)
return shift
end
end
~~~
Pull-Request: #781
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Fri, 26 Sep 2014 03:38:47 +0000 (23:38 -0400)]
tests: add base_gen_redef.nit
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 30 Sep 2014 01:13:05 +0000 (21:13 -0400)]
toolcontext: new option -w to enable/disable warning
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 30 Sep 2014 00:47:24 +0000 (20:47 -0400)]
compiler: compile_dir can be anywhere
Signed-off-by: Jean Privat <jean@pryen.org>
Jean-Christophe Beaupré [Mon, 29 Sep 2014 19:03:35 +0000 (15:03 -0400)]
misc/jenkins: fix checklicense.sh
* Correct documentation.
* Fix the regular expression for the sought comment.
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Jean Privat [Mon, 29 Sep 2014 20:16:33 +0000 (16:16 -0400)]
examples: update clock.nit with manual setter+autoinit
Signed-off-by: Jean Privat <privat@pryen.org>
Jean Privat [Mon, 29 Sep 2014 20:14:35 +0000 (16:14 -0400)]
tests: add base_init_autoinit.nit
Signed-off-by: Jean Privat <privat@pryen.org>
Jean Privat [Mon, 29 Sep 2014 19:54:59 +0000 (15:54 -0400)]
modelize: new annotation `autoinit` for manual setters
Signed-off-by: Jean Privat <privat@pryen.org>
Jean Privat [Mon, 29 Sep 2014 19:52:43 +0000 (15:52 -0400)]
modelize: remove a useless local variable
Signed-off-by: Jean Privat <privat@pryen.org>
Jean Privat [Mon, 29 Sep 2014 19:37:08 +0000 (15:37 -0400)]
engines: handle initializers with an arity!=1
Signed-off-by: Jean Privat <privat@pryen.org>
Jean Privat [Mon, 29 Sep 2014 17:07:35 +0000 (13:07 -0400)]
Merge: Less old style init special cases
The general transition to new constructor is nearer each day.
May fix an issue informally signaled by @R4PaSs.
Pull-Request: #783
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Sat, 27 Sep 2014 12:15:57 +0000 (08:15 -0400)]
src: migrate some modules to new constructors
Signed-off-by: Jean Privat <privat@pryen.org>
Jean Privat [Sat, 27 Sep 2014 08:23:21 +0000 (04:23 -0400)]
tests: update related to the init changes
Signed-off-by: Jean Privat <privat@pryen.org>
Jean Privat [Sat, 27 Sep 2014 02:49:58 +0000 (22:49 -0400)]
modelize: simplify special-case for named constrcutors
The only remaining case is for old style init named "init" since they
need a move clever transition scheme.
Signed-off-by: Jean Privat <privat@pryen.org>
Jean Privat [Sat, 27 Sep 2014 02:48:03 +0000 (22:48 -0400)]
lib: some update towards more use of new constructors
Signed-off-by: Jean Privat <privat@pryen.org>
Jean Privat [Fri, 26 Sep 2014 20:29:07 +0000 (16:29 -0400)]
Merge: Clean more tests
Some improvements in misc/jenkins and tests/tests.sh
Also, disable a lot of lib/ and contrib/ programs.
There is currently no point to compile them in all engines since most do nothing or are not executable.
The validity of all modules is now tested thanks to misc/jenkins/listnit.sh (warnings, units, metrics).
Thus it is no more the job of tests.sh to look after them.
Pull-Request: #780
Jean Privat [Fri, 26 Sep 2014 03:36:53 +0000 (23:36 -0400)]
separate_compiler: use the easier way to get a mparameter from a mclass
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 03:33:27 +0000 (23:33 -0400)]
src: update tools to new names in generic parameters
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 03:31:12 +0000 (23:31 -0400)]
modelize_class: update resolve_mtype for new generic parameter names in the class
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 03:29:20 +0000 (23:29 -0400)]
modelize_class: redefinition of generic classes do not need to repeat generic parameter declarations
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 03:28:25 +0000 (23:28 -0400)]
modelize_class: adapt MClass and MClassDef creation to new mparameters
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 03:12:44 +0000 (23:12 -0400)]
lib: rename E to V in Map-related classes
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 02:24:41 +0000 (22:24 -0400)]
tests: update sav/nitunit_args1.res
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 01:08:46 +0000 (21:08 -0400)]
tests: add puzzle_args1.res
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 01:08:07 +0000 (21:08 -0400)]
tests: do not test all lib and contrib.
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 00:38:20 +0000 (20:38 -0400)]
jenkins: add --quiet to time in unitrun.sh
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 00:29:39 +0000 (20:29 -0400)]
nitunit: prefix xml packagenames with 'nitunit.'
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 00:22:41 +0000 (20:22 -0400)]
tests: sum the first-execution time with the compilation time
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 00:22:05 +0000 (20:22 -0400)]
tests: add --quiet with time to avoid poluted time output
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 00:21:10 +0000 (20:21 -0400)]
tests: interpteters have a 0 time compilation (fix tests output with interpreters)
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 26 Sep 2014 00:19:55 +0000 (20:19 -0400)]
tests: prexif xml packages with 'tests..'
Signed-off-by: Jean Privat <jean@pryen.org>