Jean Privat [Wed, 22 Apr 2015 16:11:36 +0000 (23:11 +0700)]
nitrpg: add new player panel for work to do
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 22 Apr 2015 16:11:20 +0000 (23:11 +0700)]
nitrpg: extends PlayerReviewsPanel to add `request_for_comments` tags
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 22 Apr 2015 06:46:03 +0000 (13:46 +0700)]
Merge: Small clean up and improvements to MNit from WBTW
The new OpenGL parameters affect the display of images for a better pixelated look:
* When zoomed out, the image is smoother, the color values are interpolated from the nearest source pixels.
* When zoomed in, the image is displayed pixelated.
You may recognize the `Int::next_pow` method, `inkscape_tools` use something similar for the same purpose. Actually, with this PR, `inkscape_tools` may not need it anymore and produce smaller PNG files.
Pull-Request: #1284
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Jean Privat [Wed, 22 Apr 2015 04:18:41 +0000 (11:18 +0700)]
Merge: share/man: Update man for `nitpretty`
Fixes #1130
Pull-Request: #1290
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 22 Apr 2015 04:18:34 +0000 (11:18 +0700)]
Merge: Inkscape tool revamp and gamnit support
* Clean up old style inits, add missing doc and refactor main code into classes and methods.
* Adds the gamnit target option, the generated code is much more simple, but the generation a bit more complex.
* Allow to specify the full path to the Nit source file to generate.
* Make rounding to the next power of 2 optional, it will no more be required for mnit programs on Android with #1284.
Pull-Request: #1285
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Wed, 22 Apr 2015 04:18:23 +0000 (11:18 +0700)]
Merge: Nitdoc: more cleaning and uniformize method names
Démos:
* [stdlib](http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/stdlib/index.html)
* [nitc](http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/nitc/index.html)
Pull-Request: #1283
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Jean Privat [Wed, 22 Apr 2015 04:18:11 +0000 (11:18 +0700)]
Merge: nitrpg: minor enhancements
Mainly designed to fully close #1168 and work on #1161.
Pull-Request: #1185
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Alexandre Terrasa [Tue, 21 Apr 2015 23:48:47 +0000 (19:48 -0400)]
nitpretty: fixes typo in option comment
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 21 Apr 2015 23:47:36 +0000 (19:47 -0400)]
share/man: Update man for `nitpretty`
Fixes #1130
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 21 Apr 2015 23:33:20 +0000 (19:33 -0400)]
contrib/nitrpg: add a Comparator to sort games by number of players
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 23 Feb 2015 13:10:48 +0000 (14:10 +0100)]
contrib/nitrpg: return 404 on bad urls
Fixes #1168
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 23 Feb 2015 12:54:23 +0000 (13:54 +0100)]
contrib/nitrpg: display the list of active games in /games
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 23 Feb 2015 12:50:27 +0000 (13:50 +0100)]
contrib/nitrpg: display the readme and the active game list in homepage.
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 23 Feb 2015 12:37:29 +0000 (13:37 +0100)]
contrib/nitrpg: factorize game loading service from GameAction
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 23 Feb 2015 12:36:41 +0000 (13:36 +0100)]
contrib/nitrpg: add GamesListPanel to display the list of active games
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 23 Feb 2015 12:36:20 +0000 (13:36 +0100)]
contrib/nitrpg: add MDPanel to display MDContent
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 23 Feb 2015 12:35:43 +0000 (13:35 +0100)]
contrib/nitrpg: add a README file
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 23 Feb 2015 11:07:04 +0000 (12:07 +0100)]
contrib/nitrpg: add some achievements on IssueComments
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexis Laferrière [Tue, 21 Apr 2015 10:09:24 +0000 (06:09 -0400)]
contrib/inkscape_tools: update README.md file
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 21 Apr 2015 10:03:43 +0000 (06:03 -0400)]
contrib/inkscape_tools: make rounding to the next power of 2 optional
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 19 Apr 2015 16:38:16 +0000 (12:38 -0400)]
contrib/inkscape_tools: add alternative code generation for gamnit target
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 21 Apr 2015 09:56:21 +0000 (05:56 -0400)]
contrib/inkscape_tools: refactor main code into 2 new classes
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexandre Terrasa [Mon, 23 Feb 2015 19:45:42 +0000 (20:45 +0100)]
src/doc: clean signature HTML output with `html_signature` and `html_short_signature`
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 23 Feb 2015 19:12:37 +0000 (20:12 +0100)]
src/doc: rename `tpl_namespace` in `html_namespace` also clean comments
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 23 Feb 2015 18:59:28 +0000 (19:59 +0100)]
src/doc: rename `tpl_declaration` in `html_declaration` and uniformize output
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 23 Feb 2015 18:17:31 +0000 (19:17 +0100)]
src/doc: rename `tpl_anchor` into `html_link_to_anchor` and use bootstrap template
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 21 Apr 2015 12:28:48 +0000 (08:28 -0400)]
src/doc: rename `tpl_link` into `html_link` and use bootstrap template
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexis Laferrière [Thu, 16 Apr 2015 15:40:44 +0000 (11:40 -0400)]
contrib/inkscape_tools: add option for the full path to the generated source
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 16 Apr 2015 15:38:29 +0000 (11:38 -0400)]
contrib/inkscape_tools: revamp doc of svg_to_png_and_nit
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 11 Mar 2015 15:10:09 +0000 (11:10 -0400)]
lib/mnit: fix and improve magnification for a pixelized (to smooth) look
The new OpenGL paramenter act of the display of images:
* When zoomed out, the image is smoother, the color values are interpolated
from the neares source pixels.
* When zoomed in, the image is displayed pixelized.
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 22 Feb 2015 18:07:16 +0000 (13:07 -0500)]
lib/mnit: print the approximate memory used by textures loaded in memory
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 22 Feb 2015 17:55:49 +0000 (12:55 -0500)]
lib/mnit: expand images to the nearest power of 2 for OpenGL ES 1.0
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 22 Feb 2015 17:54:03 +0000 (12:54 -0500)]
lib/mnit: use PRINT_ERROR instead of printf on portable code
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 16 Apr 2015 15:37:35 +0000 (11:37 -0400)]
contrib/inkscape_tools: remove old_style constructor and whitespace error
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Sun, 19 Apr 2015 00:07:12 +0000 (07:07 +0700)]
Merge: Default arguments
Default arguments (aka parameters with a default value) are often a nice way to provide a complex operation with a lot of variations but allow the client to use it in a simple form when no complexity is required.
Also, it allows to extends the signature of existing operations while being API-compatible with previous versions.
This PR introduces default arguments to Nit as another tool in the toolbox of library designers.
The specification is quite simple:
* a nullable parameter can be ignored, the value of the argument will default to null
~~~nit
fun foo(a: Int, b: nullable Int) do ...
foo(1)
foo(1, null) # equivalent thing
~~~
* default parameters can be anywhere (not necessarily at the end)
~~~nit
fun foo(a: nullable Int, b: Int) do ...
foo(1)
foo(null, 1) # equivalent thing
~~~
* when there is multiple possible associations between arguments and parameters, arguments will be associated to the leftmost (first) parameter first.
~~~nit
fun foo(a, b: nullable Int) do ...
foo(1)
foo(1, null) # equivalent thing
~~~
* if there is a vararg, all other parameters are mandatory (no default)
~~~nit
fun foo(a: Int..., b: nullable Int) do ...
foo(1) # Error: minimum 2 arguments (we chose that varargs require a minimum of 1 argument, but this old choice is a different issue)
foo(1, 2) # OK
foo([1]..., 2) # equivalent thing
~~~
* the last parameter of an assignment method (that is the right value of the assignment) is never default. For POLA reasons, the last argument is distinguished and syntactically mandatory, so the association with the parameter is always direct and unambiguous.
~~~nit
fun foo=(a, b: nullable Int) do ...
foo = 1
foo(null) = 1 # equivalent thing
~~~
I chose this specification because it uses the nullable facility of Nit in a nice way and is somewhat semantic: `null` means nothing to say, or keep it blank.
I prefer it over the specification of other languages that is to declare a specific default value on the declaration of parameters.
* no need not to update the grammar
* no need to specify the language of the default value (any expressions? only literal? other?)
* no need to specify when and by who the default value is evaluated (and what is the value of self? are the other parameters usable in the expression? etc.)
* no need to specify how to deal with default values on redefinitions in a OO point of view (do I inherit the default value? can I `super` the default value?)
* no need to expose the expressions used as default values in the metamodel
* no need to expose the expressions used as default values in the doc
Most of these things make the language less KISS (obviously), and less POLA because whatever spec we can choose for these points, 1) not 100% of user will find them obvious; and 2) for some cases the wanted behavior will not be the specified one.
Note that in Python, while they allow to define a specific default value on parameters, they recommend to use `null` as a default to avoid most of these aforementioned problems.
Note2: this PR was unlocked by #1269 and #1268
Pull-Request: #1280
Reviewed-by: Etienne M. Gagnon <egagnon@j-meg.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Ait younes Mehdi Adel <overpex@gmail.com>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Thu, 16 Apr 2015 11:40:15 +0000 (18:40 +0700)]
tests: add base_arg_default*.nit
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 18 Apr 2015 14:49:32 +0000 (21:49 +0700)]
neo: save MParameter::is_default
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 18 Apr 2015 13:40:26 +0000 (20:40 +0700)]
typing&engines: implement default arguments
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 11:11:09 +0000 (18:11 +0700)]
model&modelize: introduce default parameters
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 18 Apr 2015 09:47:34 +0000 (16:47 +0700)]
Merge: Snake phase names
Default name of phases where based on a lower cased version of their classnames.
That was bad. eg `FFILanguageAssignationPhase` -> `ffilanguageassignation`
So this PR snakecase them instead.
But the spec of `to_snake_case` was awful: `f_f_i_language_assignation`
So also fix the spec of this method and get something nice `ffi_language_assignation`.
Pull-Request: #1276
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Sat, 18 Apr 2015 09:47:26 +0000 (16:47 +0700)]
Merge: Microbenches for niti
Some update on tests/ so that niti (and nitvm) can pass more tests
Pull-Request: #1275
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Jean Privat [Sat, 18 Apr 2015 09:47:17 +0000 (16:47 +0700)]
Merge: Autocast and literal arrays
Small bugfixes
* forbid autocasts in combined assignments and literal arrays
* keep autocast information in transform
* rta visits implicit methods of literal arrays
Only the first one was the original bug I wanted to fix, the two others where discovered and solved while writing the PR.
Pull-Request: #1272
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Jean Privat [Sat, 18 Apr 2015 09:47:09 +0000 (16:47 +0700)]
Merge: Option --keep-going
Follow up of #959 and #1241. Now an option is exposed so people can happily try to use it on various tools that will turn them berserk and make them want to kill you.
Pull-Request: #1270
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Jean Privat [Sat, 18 Apr 2015 09:47:00 +0000 (16:47 +0700)]
Merge: Check operator
Previously, no checking was done on the signature of operators.
While this is not an issue for the model nor the tools this could yield to not POLA error messages when the operator is used. eg.
~~~nit
class A
fun +(other: A) do print "hello"
end
var a = new A
var b = a + a # Error expected expression
a + a # Error unexpected operator +
# no way do invoke `+` in fact.
~~~
With the PR, we have
~~~
Error: mandatory return type for `+`.
fun +(other: A) do print "hello"
^
~~~
The following errors are added by the PR:
* mandatory return
* not enough parameters
* too much parameters
* illegal variadic parameter
Pull-Request: #1269
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Jean Privat [Sat, 18 Apr 2015 09:46:51 +0000 (16:46 +0700)]
Merge: Signature map
Provide an abstraction `SingatureMap` to factorize (and simplify) the association between arguments and parameters (not that easy in the context of varargs).
This PR is also required by a future PR.
Pull-Request: #1268
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Jean Privat [Thu, 16 Apr 2015 13:34:47 +0000 (20:34 +0700)]
tests: update test_ffi_c_operators for << and >>
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 11:04:11 +0000 (18:04 +0700)]
tests: add error_operators.nit
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 11:01:11 +0000 (18:01 +0700)]
modelize_property: implement special validity rules for operators
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 18 Apr 2015 09:36:31 +0000 (16:36 +0700)]
tests: update test_new_native.res because line change in array.nit
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 09:57:27 +0000 (16:57 +0700)]
interpreter: use SignatureMap to make varargize more robust
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 09:55:39 +0000 (16:55 +0700)]
compiler: use SignatureMap to make varargize more robust
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 17 Apr 2015 15:54:39 +0000 (22:54 +0700)]
lib/standard/array: add `Array::sub`
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 17 Apr 2015 07:25:35 +0000 (14:25 +0700)]
phases: default names is the snake_cased version of the classname
use `nitc --disable-phase list` to see them
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 17 Apr 2015 07:24:39 +0000 (14:24 +0700)]
strings: reimplement to_snake_case with a correct semantic
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 17 Apr 2015 08:11:02 +0000 (15:11 +0700)]
tests: add output for benchs that does not have some
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 17 Apr 2015 06:59:28 +0000 (13:59 +0700)]
update niti.skip and nitvm.skip to allow more tests (including benches)
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 17 Apr 2015 06:47:22 +0000 (13:47 +0700)]
tests: update benchs*.nit to have a common default time and an non-linear grow
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 17 Apr 2015 00:45:32 +0000 (07:45 +0700)]
tests: add base_autocast_array.nit
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 17 Apr 2015 01:06:35 +0000 (08:06 +0700)]
lib/string_search: avoid covariant array on `split_once_on`
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 16:33:13 +0000 (23:33 +0700)]
transform: do not lose autocast information
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 16:32:54 +0000 (23:32 +0700)]
rta: visit implicit methods of literal arrays
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 16:00:17 +0000 (23:00 +0700)]
tests: update sav/test_toolcontext* because of the new option
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 15:50:30 +0000 (22:50 +0700)]
metrics/detect_covariance: update check_subtype
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 15:50:01 +0000 (22:50 +0700)]
typing: do not autocast on arrays or combined assignment
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 15:04:04 +0000 (22:04 +0700)]
man: add --keep-going
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 14:40:13 +0000 (21:40 +0700)]
toolcontext: add --keep-going to keep going
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 08:37:41 +0000 (15:37 +0700)]
typing: introduce SignatureMap to factorize parameters<->arguments mapping work
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 16 Apr 2015 04:13:24 +0000 (11:13 +0700)]
Merge: Extends operators
* Add missing combined assignments: `*=`, `/=`, `%=`, `**=`, `<<=`, `>>=`
* Add missing unary + operator (why?)
* Keep operators in the AST for better messages
* Factorize some information in the AST to simplify code in other modules
Pull-Request: #1263
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Wed, 15 Apr 2015 05:40:32 +0000 (12:40 +0700)]
tests: update other sav for new AST of location in error messages
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 15 Apr 2015 05:39:56 +0000 (12:39 +0700)]
tests: extends base_combined_assignment and test_ffi_c_operators
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 15 Apr 2015 05:36:24 +0000 (12:36 +0700)]
lib/stc/kernel: add << and >> in Int
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 15 Apr 2015 05:37:17 +0000 (12:37 +0700)]
nitpretty: handle AUplusExpr and simplify binary operations
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 15 Apr 2015 05:38:55 +0000 (12:38 +0700)]
typing: use new `operator` and `n_op` from ABinopExpr and AAssignOp
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 15 Apr 2015 05:00:13 +0000 (12:00 +0700)]
src: implement unary plus
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 15 Apr 2015 04:50:36 +0000 (11:50 +0700)]
parser: regenerate
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 15 Apr 2015 03:50:33 +0000 (10:50 +0700)]
grammar: add more combined assignment operator
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 15 Apr 2015 04:49:59 +0000 (11:49 +0700)]
grammar: introduce n_op and operator in AAssignOp
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 15 Apr 2015 04:48:42 +0000 (11:48 +0700)]
parser: add ABinopExpr::operator to avoid refining each operator class in other modules
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 15 Apr 2015 04:09:18 +0000 (11:09 +0700)]
grammar: keep operators in the AST for better messages
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 15 Apr 2015 03:53:38 +0000 (10:53 +0700)]
grammar: as unary plus operation (only for thr sake on completion)
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 15 Apr 2015 03:34:16 +0000 (10:34 +0700)]
Merge: Review errors messages
A big PR but that just review the errors and warning messages printed by the tools.
I tries to follow a standard format:
eg. "Error: cannot find method `foo`."
* start with a message type like "Error:", "Syntax Error:", "Warning:".
The type is capitalized and terminated by a column.
The rest on the message starts with a lowercase letter and is terminated with a dot.
* be short and fit on a single line.
* have meaningful information first.
This helps the reader and remain usable
when truncated, by an IDE for instance.
* enclose identifiers, keywords and pieces of code with back-quotes.
Do not hesitate no nitpick phrasing or wording or propose better messages.
Close #931
Pull-Request: #1253
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Wed, 15 Apr 2015 03:34:05 +0000 (10:34 +0700)]
Merge: Check contrib
Add a script `misc/jenkins/check_contrib.sh` to automatically compile and tests things in contrib and examples.
New (and existing) programs in these directory should try to add some basic (or extensive) checking.
Note that I used the name `check` that is the standard name for Makefiles (`tests` seems to be an invention of myself) http://www.gnu.org/software/make/manual/make.html#Standard-Targets
Pull-Request: #1259
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Wed, 15 Apr 2015 03:33:59 +0000 (10:33 +0700)]
Merge: tests: add --autosav to automatically update the sav directory.
Advantages:
* avoid manual error-prone update (especially on large tests)
* diffs on the sav/ files may be easier to see with git tools
Drawbacks:
* the wrong sav dir can by used for specific engines/uname/etc.
* manual inspection still required
Is used for #1253 because manual updates are a PITA
Pull-Request: #1258
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Fri, 10 Apr 2015 15:44:46 +0000 (22:44 +0700)]
tests: update sav with new error messages
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 15 Apr 2015 01:14:56 +0000 (08:14 +0700)]
src: improve messages (and sometime location) of errors and warnings
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 14 Apr 2015 10:07:29 +0000 (17:07 +0700)]
model: add `MClass::signature_to_s` to use in messages.
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 9 Apr 2015 12:40:28 +0000 (19:40 +0700)]
typing: identify the node associated to method name
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 14 Apr 2015 11:57:37 +0000 (18:57 +0700)]
contrib: add some check rules
`check` is the expected name for Makefile, `tests` is a nitism
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 14 Apr 2015 11:56:44 +0000 (18:56 +0700)]
jenkins: add check_contrib.sh to automatically compile and check contribs
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 14 Apr 2015 11:11:11 +0000 (18:11 +0700)]
tests: add --autosav to automatically update the sav directory.
Advantages:
* avoid manual error-prone update (especially on large tests)
* diffs on the sav/ files may be easier to see with git tools
Drawbacks:
* the wrong sav dir can by used for specific engines/uname/etc.
* manual inspection still required
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 14 Apr 2015 09:33:40 +0000 (16:33 +0700)]
Merge: Fix type adaptation when there is loops
Basically one of the oldest bug of Nit.
The point of adaptive typing is that the static types of variables follows the static types of the assigned values, type tests and comparison to null.
This is a great feature of the language but was buggy because loops where not taken in account (old TODO), until the present PR.
The basic idea is just to track if a type adaptation occurs, if yes replay the whole typing phase.
The immediate drawback is that now typing require 2 passes most of the time, and sometime more.
This PR was a roller-coaster of emotions to develop since a lot a surprise issues were discovered.
* bug in flow that give me hours of despair.
* duplication of error messages; because multiple passes.
* premature warning/error messages; because some error conditions on types are detected at the first pass but a second pass find it is fine in fact... but too late the error message was printed.
* almost work at the first time (modulo the previous issues)
* only two bugs found in the whole code, quite impressive, and one of them is not a real bug but an autocast issue.
The issue about error duplication and premature errors is only workadounded (or fixme) in most places.
But proper solutions will be required in future PR.
close #647 and close #86, then reopen it again, then reclose it.
Pull-Request: #1257
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Tue, 14 Apr 2015 09:33:32 +0000 (16:33 +0700)]
Merge: Intern new
A small short PR that enables a `new`-factory to instantiate itself.
previously there was no way to do that. The following code will stack-overflow:
~~~nit
class A
new do
var res = new A
res.do_thigns
return res
end
end
var a = new A # infinite recursion of `new A`
~~~
Note: this is a very bad example as what is done in the previous `new` should be done in an `init` instead since it is related to the initialization of the object. A `new` factory should be exclusively used for some factory-concern like returning a more specialized object or returning an already existing object.
With this PR, the primitive constructor is available and is called `intern`, as the annotation that indicates things that cannot be programmed in Nit but are provided by the execution engine.
So in the previous example, just use this primitive constructor instead of doing a recursive call:
~~~
var res = new A.intern
~~~
This intern constructor just do the allocation and the initialization of attributes with default values.
`init` is not called.
Maybe it should not do the initialization of attributes neither but if I skip them, there is no way for the programmer to ask for them manually. whereas `init` in not automatically called but can be called manually.
note: this PR is a small step toward the conclusion of the constructor saga, more will come soon (I hope)
Pull-Request: #1252
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Tue, 14 Apr 2015 09:33:22 +0000 (16:33 +0700)]
Merge: Improved parallelization phase
The "threaded" annotation now supports functions with parameters !
Still need to check for eventual self calls in the body of the annotated function
Pull-Request: #1255
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Tue, 14 Apr 2015 09:32:55 +0000 (16:32 +0700)]
Merge: Make the generated iOS project compilable in the XCode GUI
I originally incorporated the test project in the generated XCode workspace thinking that we could use it somehow. But it duplicates services from nitunits and it would be much more complex to use.
I remove the test project now because it is incomplete and raise errors from the XCode GUI.
Pull-Request: #1254
Reviewed-by: ArthurDelamare <arthur.delamare@viacesi.fr>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Tue, 14 Apr 2015 09:32:40 +0000 (16:32 +0700)]
Merge: Vim plugin fixes and make Nitdoc a command with search capabilities
You can now use Nitdoc as a command in Vim.
* Search the doc for the word under the cursor with `:Nitdoc`
* Display the doc of the `String` class (followed by all docs using the word "String", case-insensitive) with `:Nitdoc String`
* Display the doc of `Int::%` with `:Nitdoc modulo`
* Search for a string of words (in the given order) with `:Nitdoc not null`
Some query can produce quite a lot results. `:Nitdoc the` will fill the preview window with 33 379 lines of doc, but there no noticeable delay.
### Bonus tip!
Navigate in the doc by moving the cursor above a word in the preview window and using ctrl-D (or `:Nitdoc`), exactly as you would do in Nit code.
Pull-Request: #1256
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Sun, 12 Apr 2015 04:14:58 +0000 (11:14 +0700)]
tests: add base_adaptive_loop*.nit
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 11 Apr 2015 17:14:40 +0000 (00:14 +0700)]
tests: update sav for existing tests
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 11 Apr 2015 17:13:56 +0000 (00:13 +0700)]
toolcontext: avoid duplicated messages
This is just a workaround to limit repeated errors message because of
adapting typing
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 11 Apr 2015 17:12:50 +0000 (00:12 +0700)]
lib/ai/backtrack: add a missing assert
or else the possible null will loop and cause errors.
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 11 Apr 2015 17:11:40 +0000 (00:11 +0700)]
lib/a_star: avoid bad autocast
Seriously, this one case might be a strong argument against autocasts
~~~
frontier_node = frontier_node.best_source.as(not null)
~~~
is auto-casted as
~~~
frontier_node = frontier_node.best_source.as(not null).as(N)
~~~
bun since the N is `nullable Node`, the not-null information was lost in the
cast.
Signed-off-by: Jean Privat <jean@pryen.org>