Merge: c_tool: reorder CC arguments since the semantic between gcc and clang differs
authorJean Privat <jean@pryen.org>
Mon, 10 Aug 2015 19:36:23 +0000 (15:36 -0400)
committerJean Privat <jean@pryen.org>
Mon, 10 Aug 2015 19:36:23 +0000 (15:36 -0400)
Just a reordering to really silent the warning on osx

Pull-Request: #1627
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

75 files changed:
contrib/pep8analysis/src/ast/suffixed_instructions.nit
examples/rosettacode/bitwise_operations.nit
examples/rosettacode/hailstone.nit
examples/rosettacode/perlin_noise.nit
lib/a_star.nit
lib/ai/backtrack.nit
lib/bcm2835/bcm2835.nit
lib/bitmap/bitmap.nit
lib/bucketed_game.nit
lib/github/hooks.nit
lib/markdown/markdown.nit
lib/mnit/image_set.nit
lib/nitcc_runtime.nit
lib/noise.nit
lib/perfect_hashing.nit
lib/serialization/serialization.nit
lib/sexp.nit
lib/standard/kernel.nit
lib/standard/math.nit
lib/standard/re.nit
lib/standard/text/abstract_text.nit
lib/standard/text/flat.nit
src/compiler/abstract_compiler.nit
src/compiler/java_compiler.nit
src/compiler/separate_compiler.nit
src/doc/doc_phases/doc_readme.nit
src/doc/doc_phases/doc_structure.nit
src/interpreter/naive_interpreter.nit
src/model/model.nit
src/modelize/modelize_property.nit
src/neo.nit
src/parser/parser_nodes.nit
src/semantize/typing.nit
tests/Darwin.skip
tests/README.md
tests/base_arg_default.nit
tests/base_arg_default_autoinit.nit
tests/base_arg_named.nit
tests/base_arg_named_inherit.nit
tests/base_arg_order.nit
tests/bench_add_all.nit
tests/bench_bintree_gen.nit
tests/bench_netsim.nit
tests/bench_nsieve_bool.nit
tests/bench_send.nit
tests/bench_send2.nit
tests/sav/Darwin/test_regex_check_alt1.res [new file with mode: 0644]
tests/sav/Darwin/test_regex_check_alt2.res [new file with mode: 0644]
tests/sav/Darwin/test_regex_check_alt3.res [new file with mode: 0644]
tests/sav/Darwin/todo [new file with mode: 0644]
tests/sav/base_arg_default.res
tests/sav/base_arg_default_alt1.res
tests/sav/base_arg_default_autoinit.res
tests/sav/base_arg_default_autoinit_alt1.res
tests/sav/base_arg_named.res
tests/sav/base_arg_named_alt1.res
tests/sav/base_arg_named_inherit.res
tests/sav/base_arg_named_inherit_alt1.res
tests/sav/base_arg_named_inherit_alt2.res
tests/sav/base_arg_named_inherit_alt3.res [new file with mode: 0644]
tests/sav/base_arg_order.res
tests/sav/error_class_glob.res
tests/sav/nitce/fixme/base_gen_reassign_alt4.res
tests/sav/nitce/fixme/base_gen_reassign_alt5.res
tests/sav/nitce/fixme/base_gen_reassign_alt6.res
tests/sav/nituml_args3.res
tests/sav/nituml_args4.res
tests/sav/test_binariesop.res
tests/shootout_binarytrees.nit
tests/shootout_mandelbrot.nit
tests/shootout_nsieve.nit
tests/shootout_nsieve_bytes_alt.nit
tests/test_binariesop.nit
tests/tests.sh
tests/todo [new file with mode: 0644]

index 6466430..ea9f4e0 100644 (file)
@@ -32,7 +32,7 @@ end
 #
 redef class AUnaryNopInstruction
        super ADigitSuffixed
-       redef fun digit_max do return 1.lshift(2)-1
+       redef fun digit_max do return (1 << 2)-1
 end
 
 redef class ANotInstruction
@@ -49,7 +49,7 @@ end
 
 redef class ARetInstruction
        super ADigitSuffixed
-       redef fun digit_max do return 1.lshift(3)-1
+       redef fun digit_max do return (1 << 3)-1
 end
 
 redef abstract class AArithmeticInstruction
index c24ee4e..d543ad5 100644 (file)
@@ -5,15 +5,14 @@
 
 # Task: Bitwise operations
 # SEE: <http://rosettacode.org/wiki/Bitwise_operations>
-# Without logical right shift
 module bitwise_operations
 
 fun bitwise(a, b: Int)
 do
-       print "a and b: { a.bin_and(b) }"
-       print "a or b: { a.bin_or(b) }"
-       print "a xor b: { a.bin_xor(b) }"
-       print "not a: { a.bin_not }"
+       print "a and b: { a & b }"
+       print "a or b: { a | b }"
+       print "a xor b: { a ^ b }"
+       print "not a: { ~a }"
        print "a << b: { a << b }"
        print "a >> b: { a >> b }"
 end
index b76c533..af68297 100644 (file)
@@ -25,7 +25,7 @@ fun hailstone (n: Int): Array[Int]
 do
        var sequence = [n]
        while n != 1 do
-               if n.bin_and(0x01) == 0 then
+               if n & 0x01 == 0 then
                        n = n / 2
                else
                        n = 3 * n + 1
index a3352da..0733bbf 100644 (file)
@@ -33,9 +33,9 @@ class ImprovedNoise
        # Noise value in [-1..1] at 3d coordinates `x, y, z`
        fun noise(x, y, z: Float): Float
        do
-               var xx = x.to_i.bin_and(255)
-               var yy = y.to_i.bin_and(255)
-               var zz = z.to_i.bin_and(255)
+               var xx = x.to_i & 255
+               var yy = y.to_i & 255
+               var zz = z.to_i & 255
 
                x -= x.floor
                y -= y.floor
@@ -65,10 +65,10 @@ class ImprovedNoise
        # Value at a corner of the grid
        fun grad(hash: Int, x, y, z: Float): Float
        do
-               var h = hash.bin_and(15)
+               var h = hash & 15
                var u = if h < 8 then x else y
                var v = if h < 4 then y else if h == 12 or h == 14 then x else z
-               return (if h.is_even then u else -u) + (if h.bin_and(2) == 0 then v else -v)
+               return (if h.is_even then u else -u) + (if h & 2 == 0 then v else -v)
        end
 end
 
index 9780e12..ba6b45e 100644 (file)
@@ -316,7 +316,7 @@ class AStarPath[N]
 end
 
 # Context related to an evocation of pathfinding
-class PathContext
+abstract class PathContext
        serialize
 
        # Type of the nodes in `graph`
@@ -400,7 +400,7 @@ class WeightedLink
 end
 
 # Advanced path conditions with customizable accept states
-class TargetCondition[N: Node]
+abstract class TargetCondition[N: Node]
        serialize
 
        # Should the pathfinding accept `node` as a goal?
index ddc68ef..597164d 100644 (file)
@@ -40,7 +40,7 @@ module backtrack
 # # Basic search
 #
 # The method `solve` returns a new solver for a backtrack search.
-class BacktrackProblem[S: Object,A]
+abstract class BacktrackProblem[S: Object,A]
        # The starting state of the problem.
        # It is this object that will be modified by `apply_action` and `backtrack`.
        fun initial_state: S is abstract
index 99fd4a4..a7f9d69 100644 (file)
@@ -213,15 +213,15 @@ class HD44780
        do
                var fs = flag_function_set
                if bits == 8 then
-                       fs = fs.bin_or(16)
+                       fs = fs | 16
                else if bits != 4 then abort
 
                if lines == 2 then
-                       fs = fs.bin_or(8)
+                       fs = fs | 8
                else if lines != 1 then abort
 
                if dots_wide == 10 then
-                       fs = fs.bin_or(4)
+                       fs = fs | 4
                else if dots_wide != 8 then abort
 
                write(true, fs)
@@ -231,17 +231,11 @@ class HD44780
        do
                var fs = flag_display_control
 
-               if on then
-                       fs = fs.bin_or(flag_display_on)
-               else fs = fs.bin_or(flag_display_off)
+               fs |= if on then flag_display_on else flag_display_off
 
-               if cursor then
-                       fs = fs.bin_or(flag_cursor_on)
-               else fs = fs.bin_or(flag_cursor_off)
+               fs |= if cursor then flag_cursor_on else flag_cursor_off
 
-               if blink then
-                       fs = fs.bin_or(flag_blink_on)
-               else fs = fs.bin_or(flag_blink_off)
+               fs |= if blink then flag_blink_on else flag_blink_off
 
                write(true, fs)
        end
@@ -250,13 +244,9 @@ class HD44780
        do
                var fs = flag_entry_mode_set
 
-               if left then
-                       fs = fs.bin_or(flag_entry_left)
-               else fs = fs.bin_or(flag_entry_right)
+               fs |= if left then flag_entry_left else flag_entry_right
 
-               if incr then
-                       fs = fs.bin_or(flag_entry_shift_increment)
-               else fs = fs.bin_or(flag_entry_shift_decrement)
+               fs |= if incr then flag_entry_shift_increment else flag_entry_shift_decrement
 
                write(true, fs)
        end
@@ -349,7 +339,7 @@ class HD44780
                var lb = once [1,2,4,8]
                for i in [0..4[ do
                        var b = lb[i]
-                       var r = b.bin_and(v) != 0
+                       var r = b & v != 0
                        var d = ds[i]
                        d.write(r)
                end
@@ -384,7 +374,7 @@ class HD44780
                var hb = once [16,32,64,128]
                for i in [0..4[ do
                        var b = hb[i]
-                       var r = b.bin_and(cmd) != 0
+                       var r = b & cmd != 0
                        var d = ds[i]
                        d.write(r)
                end
@@ -403,7 +393,7 @@ class HD44780
                var lb = once [1,2,4,8]
                for i in [0..4[ do
                        var b = lb[i]
-                       var r = b.bin_and(cmd) != 0
+                       var r = b & cmd != 0
                        var d = ds[i]
                        d.write(r)
                end
index 505abcf..e408402 100644 (file)
@@ -199,10 +199,10 @@ class Bitmap
        # type, Int is used.
        private fun set_value(array: Array[Int], start_index: Int, value: Int)
        do
-               array[start_index] = value.bin_and(0x000000FF)
-               array[start_index + 1] = value.rshift(8).bin_and(0x000000FF)
-               array[start_index + 2] = value.rshift(16).bin_and(0x000000FF)
-               array[start_index + 3] = value.rshift(24).bin_and(0x000000FF)
+               array[start_index] = value & 0x000000FF
+               array[start_index + 1] = (value >> 8) & 0x000000FF
+               array[start_index + 2] = (value >> 16) & 0x000000FF
+               array[start_index + 3] = (value >> 24) & 0x000000FF
        end
 
        # Saves the bitmap into a file
@@ -223,9 +223,9 @@ class Bitmap
                        var row = self.data[x]
                        for y in [0..self.width[ do
                                var pixel = row[y]
-                               var red = pixel.rshift(16)
-                               var green = pixel.bin_and(0x00FF00).rshift(8)
-                               var blue = pixel.bin_and(0x000000FF)
+                               var red = pixel >> 16
+                               var green = (pixel & 0x00FF00) >> 8
+                               var blue = pixel & 0x000000FF
                                fw.write(red.ascii.to_s)
                                fw.write(green.ascii.to_s)
                                fw.write(blue.ascii.to_s)
@@ -241,9 +241,9 @@ class Bitmap
                        var row = self.data[x]
                        for y in [0..self.width[ do
                                var pixel = row[y]
-                               var red = pixel.rshift(16)
-                               var green = pixel.bin_and(0x00FF00).rshift(8)
-                               var blue = pixel.bin_and(0x000000FF)
+                               var red = pixel >> 16
+                               var green = (pixel & 0x00FF00) >> 8
+                               var blue = pixel & 0x000000FF
                                var lum = (0.2126 * red.to_f + 0.7152 * green.to_f + 0.0722 * blue.to_f).to_i
                                pixel = lum * 256 * 256 + lum * 256 + lum
                                self.data[x][y] = pixel
index ad79e6c..4060dc4 100644 (file)
@@ -25,14 +25,14 @@ module bucketed_game is serialize
 import serialization
 
 # Something acting on the game
-class Turnable[G: Game]
+abstract class Turnable[G: Game]
 
        # Execute `turn` for this instance.
        fun do_turn(turn: GameTurn[G]) is abstract
 end
 
 # Something acting on the game from time to time
-class Bucketable[G: Game]
+abstract class Bucketable[G: Game]
        super Turnable[G]
 
        private var act_at: nullable Int = null
index 351042b..04ae662 100644 (file)
@@ -51,7 +51,7 @@ import events
 import nitcorn
 
 # A nitcorn listener for Github hooks.
-class HookListener
+abstract class HookListener
 
        # Api client used to perform Github API requests.
        var api: GithubAPI
index 854eed5..251f784 100644 (file)
@@ -169,7 +169,7 @@ class MarkdownProcessor
                                if c == '\n' then
                                        eol = true
                                else if c == '\t' then
-                                       var np = pos + (4 - (pos.bin_and(3)))
+                                       var np = pos + (4 - (pos & 3))
                                        while pos < np do
                                                value.add ' '
                                                pos += 1
@@ -1838,7 +1838,7 @@ end
 
 # A markdown list line.
 # Mainly used to factorize code between ordered and unordered lists.
-class LineList
+abstract class LineList
        super Line
 
        redef fun process(v) do
index 8561b8f..f0a955e 100644 (file)
@@ -21,7 +21,7 @@ module image_set
 import assets
 
 # A set of images, look for sub-classes in projects using svg_to_png_and_nit
-class ImageSet
+abstract class ImageSet
 
        # Load images to fill this image set
        fun load_all(app: App) is abstract
index 923ef18..b413c7e 100644 (file)
@@ -494,7 +494,7 @@ class Nodes[T: Node]
 end
 
 # A production with a specific, named and statically typed children
-class NProd
+abstract class NProd
        super Node
        redef var children: SequenceRead[nullable Node] = new NProdChildren(self)
 
index 1a0d7ce..9a1ecc0 100644 (file)
@@ -356,6 +356,6 @@ redef universal Int
        # The missing 2 bits are used to tag integers by the Nit system.
        private fun mask: Int
        do
-               return bin_and(0x3FFF_FFFF)
+               return self & 0x3FFF_FFFF
        end
 end
index 9221116..d8ab3cb 100644 (file)
@@ -52,11 +52,11 @@ class Perfecthashing
                var orMask = 0
                var andMask = 0
                for i in ids do
-                       orMask = orMask.bin_or(i)
-                       andMask = andMask.bin_and(i)
+                       orMask |= i
+                       andMask &= i
                end
 
-               mask = orMask.bin_xor(andMask)
+               mask = orMask ^ andMask
 
                # Re-initialize the hashtable with null values
                for i in [0..(mask+1)] do tempht[i] = null
@@ -66,7 +66,7 @@ class Perfecthashing
                var i = mask.highest_bit
                while i != 0 do
                        if mask.getbit(i) == 1 then
-                               newmask = mask.bin_xor(1.lshift(i))
+                               newmask = mask ^ (1 << i)
 
                                # If there is no collision, replace the old mask
                                if phandp(ids, newmask) then
@@ -85,7 +85,7 @@ class Perfecthashing
        fun phandp(ids: Array[Int], mask: Int): Bool
        do
                for i in ids do
-                       var hv = i.bin_and(mask)
+                       var hv = i & mask
                        if tempht[hv] == mask then
                                return false
                        else
@@ -112,10 +112,10 @@ class Perfecthashing
        do
                var mask = phand(ids) -1
                var i = 0
-               while n+ids.length > (1.lshift(mask.number_bits(1))) do
+               while n+ids.length > (1 << mask.number_bits(1)) do
                        # When there are not enough 1-bits
                        if mask.getbit(i) == 0 then
-                               mask = mask.bin_xor(1.lshift(i))
+                               mask = mask ^ (1 << i)
                        end
                        i += 1
                end
@@ -156,7 +156,7 @@ class Perfecthashing
                        var i = inter.item.first.as(not null)
                        while i != inter.item.second and not found do
                                # Tests if this id is free for this mask
-                               var hv = i.bin_and(mask)
+                               var hv = i & mask
 
                                # If the hashtable if full, push an empty item
                                if hv >= tempht.length then
index 1fec7e9..e3ca6b3 100644 (file)
@@ -131,7 +131,7 @@ abstract class Deserializer
        # When at `true`, this may cause the accumulation of a lot of entries in `errors`.
        #
        # Default at `true`.
-       var keep_going: nullable Bool is writable
+       var keep_going: nullable Bool = null is writable
 
        # Errors encountered in the last call to `deserialize`
        var errors = new Array[Error]
index 491abdc..fa7c513 100644 (file)
@@ -99,9 +99,8 @@ class SExpProcessor
                var srclen = src.length
                var delims = once ['(', ')', '"']
                ignore_whitespaces
-               if pos >= srclen then return new SExpError("Empty S-Expression", location = new Location(line, line_offset))
+               if pos >= srclen then return new SExpError(new Location(line, line_offset), "Empty S-Expression")
                var c = src[pos]
-               if pos >= srclen then return new SExpError("Empty S-Expression")
                if c == '(' then
                        var cnt = new SExp
                        var loc = new Location(line, line_offset)
@@ -116,30 +115,32 @@ class SExpProcessor
                                pos += 1
                                return cnt
                        else
-                               return new SExpError("Incomplete S-Expression", location = loc)
+                               return new SExpError(loc, "Incomplete S-Expression")
                        end
                else if c == '"' then
                        var stdq = pos
+                       var loc = new Location(line, line_offset)
                        pos += 1
                        ignore_until("\"")
                        pos += 1
                        var endq = pos
-                       return new SExpDQString(src.substring(stdq, endq - stdq))
+                       return new SExpDQString(loc, src.substring(stdq, endq - stdq))
                else
                        var stid = pos
+                       var loc = new Location(line, line_offset)
                        while pos < srclen and not c.is_whitespace and not delims.has(c) do
                                c = src[pos]
                                pos += 1
                        end
                        if delims.has(c) or c.is_whitespace then pos -= 1
-                       if pos >= srclen then return new SExpError("Invalid S-Expression")
+                       if pos >= srclen then return new SExpError(loc, "Invalid S-Expression")
                        var endid = pos
                        var cntstr = src.substring(stid, endid - stid)
                        var cnt: SExpEntity
                        if cntstr.is_numeric then
-                               cnt = new SExpFloat(cntstr.to_f)
+                               cnt = new SExpFloat(loc, cntstr.to_f)
                        else
-                               cnt = new SExpId(cntstr)
+                               cnt = new SExpId(loc, cntstr)
                        end
                        return cnt
                end
index 11c4419..686334d 100644 (file)
@@ -623,8 +623,8 @@ universal Byte
 
        # On an Byte, unary minus will return `(256 - self) % 256`
        #
-       #     assert -(1.to_b) == 0xFF.to_b
-       #     assert -(0.to_b) == 0x00.to_b
+       #     assert -1u8 == 0xFFu8
+       #     assert -0u8 == 0x00u8
        redef fun - is intern
        redef fun -(i) is intern
        redef fun *(i) is intern
@@ -634,28 +634,22 @@ universal Byte
        #
        # Finds the remainder of division of `self` by `i`.
        #
-       #     assert 5.to_b % 2.to_b            == 1.to_b
-       #     assert 10.to_b % 2.to_b           == 0.to_b
+       #     assert 5u8 % 2u8          == 1u8
+       #     assert 10u8 % 2u8         == 0u8
        fun %(i: Byte): Byte is intern
 
        redef fun zero do return 0.to_b
        redef fun value_of(val) do return val.to_b
 
-       # `i` bits shift fo the left (aka <<)
+       # `i` bits shift fo the left
        #
-       #     assert 5.to_b.lshift(1)    == 10.to_b
-       fun lshift(i: Int): Byte is intern
+       #     assert 5u8 << 1    == 10u8
+       fun <<(i: Int): Byte `{ return self << i; `}
 
-       # alias of `lshift`
-       fun <<(i: Int): Byte do return lshift(i)
-
-       # `i` bits shift fo the right (aka >>)
+       # `i` bits shift fo the right
        #
-       #     assert 5.to_b.rshift(1)    == 2.to_b
-       fun rshift(i: Int): Byte is intern
-
-       # alias of `rshift`
-       fun >>(i: Int): Byte do return rshift(i)
+       #     assert 5u8 >> 1    == 2u8
+       fun >>(i: Int): Byte `{ return self >> i; `}
 
        redef fun to_i is intern
        redef fun to_f is intern
@@ -741,21 +735,15 @@ universal Int
        redef fun zero do return 0
        redef fun value_of(val) do return val.to_i
 
-       # `i` bits shift fo the left (aka <<)
+       # `i` bits shift fo the left
        #
-       #     assert 5.lshift(1)    == 10
-       fun lshift(i: Int): Int is intern
+       #     assert 5 << 1    == 10
+       fun <<(i: Int): Int `{ return self << i; `}
 
-       # alias of `lshift`
-       fun <<(i: Int): Int do return lshift(i)
-
-       # `i` bits shift fo the right (aka >>)
+       # `i` bits shift fo the right
        #
-       #     assert 5.rshift(1)    == 2
-       fun rshift(i: Int): Int is intern
-
-       # alias of `rshift`
-       fun >>(i: Int): Int do return rshift(i)
+       #     assert 5 >> 1    == 2
+       fun >>(i: Int): Int `{ return self >> i; `}
 
        redef fun to_i do return self
        redef fun to_f is intern
index 337355a..50b36e9 100644 (file)
@@ -66,35 +66,23 @@ redef class Int
 
        # Returns the result of a binary AND operation on `self` and `i`
        #
-       #     assert 0x10.bin_and(0x01) == 0
-       fun bin_and(i: Int): Int `{ return self & i; `}
-
-       # Alias of `bin_and`
-       fun &(i: Int): Int do return bin_and(i)
+       #     assert 0x10 & 0x01 == 0
+       fun &(i: Int): Int `{ return self & i; `}
 
        # Returns the result of a binary OR operation on `self` and `i`
        #
-       #     assert 0x10.bin_or(0x01) == 0x11
-       fun bin_or(i: Int): Int `{ return self | i; `}
-
-       # Alias of `bin_or`
-       fun |(i: Int): Int do return bin_or(i)
+       #     assert 0x10 | 0x01 == 0x11
+       fun |(i: Int): Int `{ return self | i; `}
 
        # Returns the result of a binary XOR operation on `self` and `i`
        #
-       #     assert 0x101.bin_xor(0x110) == 0x11
-       fun bin_xor(i: Int): Int `{ return self ^ i; `}
-
-       # Alias of `bin_xor`
-       fun ^(i: Int): Int do return bin_xor(i)
+       #     assert 0x101 ^ 0x110 == 0x11
+       fun ^(i: Int): Int `{ return self ^ i; `}
 
        # Returns the 1's complement of `self`
        #
-       #     assert 0x2F.bin_not == -48
-       fun bin_not: Int `{ return ~self; `}
-
-       # Alias of `bin_not`
-       fun ~: Int do return bin_not
+       #     assert ~0x2F == -48
+       fun ~: Int `{ return ~self; `}
 
        # Returns the square root of `self`
        #
@@ -114,16 +102,16 @@ redef class Int
                if o < 0 then return -(self.gcd(-o))
                if self == 0 or o == self then return o
                if o == 0 then return self
-               if self.bin_and(1) == 0 then
-                       if o.bin_and(1) == 1 then
-                               return self.rshift(1).gcd(o)
+               if self & 1 == 0 then
+                       if o & 1 == 1 then
+                               return (self >> 1).gcd(o)
                        else
-                               return self.rshift(1).gcd(o.rshift(1)).lshift(1)
+                               return (self >> 1).gcd(o >> 1) << 1
                        end
                end
-               if o.bin_and(1) == 0 then return self.gcd(o.rshift(1))
-               if self > o then return (self - o).rshift(1).gcd(o)
-               return (o - self).rshift(1).gcd(self)
+               if o & 1 == 0 then return self.gcd(o >> 1)
+               if self > o then return ((self - o) >> 1).gcd(o)
+               return ((o - self) >> 1).gcd(self)
        end
 
        # Is `self` even ?
@@ -186,35 +174,23 @@ end
 redef class Byte
        # Returns the result of a binary AND operation on `self` and `i`
        #
-       #     assert 0x10.bin_and(0x01) == 0
-       fun bin_and(i: Byte): Byte `{ return self & i; `}
-
-       # Alias of `bin_and`
-       fun &(i: Byte): Byte do return bin_and(i)
+       #     assert 0x10u8 & 0x01u8 == 0u8
+       fun &(i: Byte): Byte `{ return self & i; `}
 
        # Returns the result of a binary OR operation on `self` and `i`
        #
-       #     assert 0x10.bin_or(0x01) == 0x11
-       fun bin_or(i: Byte): Byte `{ return self | i; `}
-
-       # Alias of `bin_or`
-       fun |(i: Byte): Byte do return bin_or(i)
+       #     assert 0x10u8 | 0x01u8 == 0x11u8
+       fun |(i: Byte): Byte `{ return self | i; `}
 
        # Returns the result of a binary XOR operation on `self` and `i`
        #
-       #     assert 0x101.bin_xor(0x110) == 0x11
-       fun bin_xor(i: Byte): Byte `{ return self ^ i; `}
-
-       # Alias of `bin_xor`
-       fun ^(i: Byte): Byte do return bin_xor(i)
+       #     assert 0x101u8 ^ 0x110u8 == 0x11u8
+       fun ^(i: Byte): Byte `{ return self ^ i; `}
 
        # Returns the 1's complement of `self`
        #
-       #     assert 0x2F.bin_not == -48
-       fun bin_not: Byte `{ return ~self; `}
-
-       # Alias of `bin_not`
-       fun ~: Byte do return bin_not
+       #     assert ~0x2Fu8 == 0xD0u8
+       fun ~: Byte `{ return ~self; `}
 end
 
 redef class Float
index 1f488ad..7d588ca 100644 (file)
@@ -205,10 +205,10 @@ class Regex
        fun compile: nullable Error
        do
                var cflags = 0
-               if extended then cflags = cflags.bin_or(flag_extended)
-               if ignore_case then cflags = cflags.bin_or(flag_icase)
-               if optimize_is_in then cflags = cflags.bin_or(flag_nosub)
-               if newline then cflags = cflags.bin_or(flag_newline)
+               if extended then cflags |= flag_extended
+               if ignore_case then cflags |= flag_icase
+               if optimize_is_in then cflags |= flag_nosub
+               if newline then cflags |= flag_newline
 
                var native = self.native
                var need_compilation = native == null or cflags != cflags_cache or string != string_cache
@@ -264,8 +264,8 @@ class Regex
        private fun gather_eflags: Int
        do
                var eflags = 0
-               if not_bol then eflags = eflags.bin_or(flag_notbol)
-               if not_eol then eflags = eflags.bin_or(flag_noteol)
+               if not_bol then eflags |= flag_notbol
+               if not_eol then eflags |= flag_noteol
                return eflags
        end
 
@@ -401,7 +401,7 @@ class Regex
                text = text.to_s
                var cstr = text.to_cstring
                var eflags = gather_eflags
-               var eflags_or_notbol = eflags.bin_or(flag_notbol)
+               var eflags_or_notbol = eflags | flag_notbol
                var native_match = self.native_match
                var matches = new Array[Match]
 
index 22f25f2..d7b915c 100644 (file)
@@ -1046,7 +1046,7 @@ abstract class Text
 
                        for i in [0..length[ do
                                var char = chars[i]
-                               h = h.lshift(5) + h + char.ascii
+                               h = (h << 5) + h + char.ascii
                        end
 
                        hash_cache = h
index 26c1a90..87381e6 100644 (file)
@@ -317,7 +317,7 @@ class FlatString
                        var myitems = items
 
                        while i <= last_byte do
-                               h = h.lshift(5) + h + myitems[i].to_i
+                               h = (h << 5) + h + myitems[i].to_i
                                i += 1
                        end
 
index b1245d2..78d2c31 100644 (file)
@@ -2141,12 +2141,6 @@ redef class AMethPropdef
                        else if pname == "%" then
                                v.ret(v.new_expr("{arguments[0]} % {arguments[1]}", ret.as(not null)))
                                return true
-                       else if pname == "lshift" then
-                               v.ret(v.new_expr("{arguments[0]} << {arguments[1]}", ret.as(not null)))
-                               return true
-                       else if pname == "rshift" then
-                               v.ret(v.new_expr("{arguments[0]} >> {arguments[1]}", ret.as(not null)))
-                               return true
                        else if pname == "==" then
                                v.ret(v.equal_test(arguments[0], arguments[1]))
                                return true
@@ -2240,12 +2234,6 @@ redef class AMethPropdef
                        else if pname == "%" then
                                v.ret(v.new_expr("{arguments[0]} % {arguments[1]}", ret.as(not null)))
                                return true
-                       else if pname == "lshift" then
-                               v.ret(v.new_expr("{arguments[0]} << {arguments[1]}", ret.as(not null)))
-                               return true
-                       else if pname == "rshift" then
-                               v.ret(v.new_expr("{arguments[0]} >> {arguments[1]}", ret.as(not null)))
-                               return true
                        else if pname == "==" then
                                v.ret(v.equal_test(arguments[0], arguments[1]))
                                return true
index f1e3437..f40ce45 100644 (file)
@@ -1588,10 +1588,10 @@ redef class AMethPropdef
                        else if pname == "%" then
                                v.ret(v.new_expr("{arguments[0]} % {arguments[1]}", ret.as(not null)))
                                return true
-                       else if pname == "lshift" then
+                       else if pname == "<<" then
                                v.ret(v.new_expr("{arguments[0]} << {arguments[1]}", ret.as(not null)))
                                return true
-                       else if pname == "rshift" then
+                       else if pname == ">>" then
                                v.ret(v.new_expr("{arguments[0]} >> {arguments[1]}", ret.as(not null)))
                                return true
                        else if pname == "==" then
@@ -1692,10 +1692,10 @@ redef class AMethPropdef
                        else if pname == "%" then
                                v.ret(v.new_expr("(byte)({arguments[0]} % {arguments[1]})", ret.as(not null)))
                                return true
-                       else if pname == "lshift" then
+                       else if pname == "<<" then
                                v.ret(v.new_expr("(byte)({arguments[0]} << {arguments[1]})", ret.as(not null)))
                                return true
-                       else if pname == "rshift" then
+                       else if pname == ">>" then
                                v.ret(v.new_expr("(byte)({arguments[0]} >> {arguments[1]})", ret.as(not null)))
                                return true
                        else if pname == "==" then
index c73bf58..9fd1606 100644 (file)
@@ -2217,12 +2217,9 @@ class SeparateRuntimeFunction
                var mmethoddef = self.mmethoddef
 
                var sig = "{c_ret} {c_name}{c_sig}"
-               compiler.provide_declaration(self.c_name, "{sig} __attribute__((weak));")
+               compiler.provide_declaration(self.c_name, "{sig};")
 
                var rta = compiler.as(SeparateCompiler).runtime_type_analysis
-               if rta != null and not rta.live_mmodules.has(mmethoddef.mclassdef.mmodule) then
-                       return
-               end
 
                var recv = self.mmethoddef.mclassdef.bound_mtype
                var v = compiler.new_visitor
@@ -2264,6 +2261,8 @@ class SeparateRuntimeFunction
                                assert subret != null
                                v.assign(frame.returnvar.as(not null), subret)
                        end
+               else if rta != null and not rta.live_mmodules.has(mmethoddef.mclassdef.mmodule) then
+                       v.add_abort("FATAL: Dead method executed.")
                else
                        mmethoddef.compile_inside_to_c(v, arguments)
                end
index 0a43edb..4e5e2dc 100644 (file)
@@ -256,12 +256,12 @@ redef class ListCommand
                end
                var mentity = res.first
                if mentity isa MModule then
-                       v.add_article new MEntitiesListArticle("Classes", mentity.mclassdefs)
+                       v.add_article new MEntitiesListArticle("Classes", null, mentity.mclassdefs)
                else if mentity isa MClass then
                        var mprops = mentity.collect_intro_mproperties(public_visibility)
-                       v.add_article new MEntitiesListArticle("Methods", mprops.to_a)
+                       v.add_article new MEntitiesListArticle("Methods", null, mprops.to_a)
                else if mentity isa MClassDef then
-                       v.add_article new MEntitiesListArticle("Methods", mentity.mpropdefs)
+                       v.add_article new MEntitiesListArticle("Methods", null, mentity.mpropdefs)
                end
        end
 end
index 96bc219..aaf137f 100644 (file)
@@ -55,7 +55,7 @@ redef class OverviewPage
                sorter.sort mprojects
                var section = new DocSection("projects.section", "Projects")
                for mproject in mprojects do
-                       section.add_child new DefinitionArticle("{mproject.nitdoc_id}.definition", mproject)
+                       section.add_child new DefinitionArticle("{mproject.nitdoc_id}.definition", null, mproject)
                end
                article.add_child section
        end
@@ -69,18 +69,18 @@ redef class SearchPage
                v.name_sorter.sort(mclasses)
                var mprops = doc.mproperties.to_a
                v.name_sorter.sort(mprops)
-               root.add_child new IndexArticle("index.article", mmodules, mclasses, mprops)
+               root.add_child new IndexArticle("index.article", null, mmodules, mclasses, mprops)
        end
 end
 
 redef class MGroupPage
        redef fun apply_structure(v, doc) do
-               var section = new MEntitySection("{mentity.nitdoc_name}.section", mentity)
+               var section = new MEntitySection("{mentity.nitdoc_name}.section", null, mentity)
                root.add_child section
                if mentity.is_root then
-                       section.add_child new IntroArticle("{mentity.mproject.nitdoc_id}.intro", mentity.mproject)
+                       section.add_child new IntroArticle("{mentity.mproject.nitdoc_id}.intro", null, mentity.mproject)
                else
-                       section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", mentity)
+                       section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", null, mentity)
                end
                var concerns = self.concerns
                if concerns == null or concerns.is_empty then return
@@ -90,11 +90,11 @@ redef class MGroupPage
                concerns.sort_with(v.concerns_sorter)
                mentity.mproject.booster_rank = 0
                mentity.booster_rank = 0
-               section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", mentity, concerns)
+               section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", null, mentity, concerns)
                for mentity in concerns do
-                       var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", mentity)
+                       var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", null, mentity)
                        if mentity isa MModule then
-                               ssection.add_child new DefinitionArticle("{mentity.nitdoc_id}.definition", mentity)
+                               ssection.add_child new DefinitionArticle("{mentity.nitdoc_id}.definition", null, mentity)
                        end
                        section.add_child ssection
                end
@@ -103,9 +103,9 @@ end
 
 redef class MModulePage
        redef fun apply_structure(v, doc) do
-               var section = new MEntitySection("{mentity.nitdoc_name}.section", mentity)
+               var section = new MEntitySection("{mentity.nitdoc_name}.section", null, mentity)
                root.add_child section
-               section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", mentity)
+               section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", null, mentity)
                var concerns = self.concerns
                if concerns == null or concerns.is_empty then return
                # FIXME avoid diff
@@ -116,25 +116,25 @@ redef class MModulePage
                mentity.mgroup.mproject.booster_rank = 0
                mentity.mgroup.booster_rank = 0
                mentity.booster_rank = 0
-               section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", mentity, concerns)
+               section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", null, mentity, concerns)
                # reference list
                for mentity in concerns do
-                       var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", mentity)
+                       var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", null, mentity)
                        if mentity isa MModule then
                                var mclasses = mclasses_for_mmodule(mentity).to_a
                                v.name_sorter.sort(mclasses)
                                for mclass in mclasses do
                                        var article = new DefinitionListArticle(
-                                               "{mclass.intro.nitdoc_id}.definition-list", mclass)
+                                               "{mclass.intro.nitdoc_id}.definition-list", null, mclass)
                                        var mclassdefs = mclassdefs_for(mclass).to_a
                                        if not mclassdefs.has(mclass.intro) then
                                                article.add_child(new DefinitionArticle(
-                                                       "{mclass.intro.nitdoc_id}.definition", mclass.intro))
+                                                       "{mclass.intro.nitdoc_id}.definition", null, mclass.intro))
                                        end
                                        doc.mainmodule.linearize_mclassdefs(mclassdefs)
                                        for mclassdef in mclassdefs do
                                                article.add_child(new DefinitionArticle(
-                                                       "{mclassdef.nitdoc_id}.definition", mclassdef))
+                                                       "{mclassdef.nitdoc_id}.definition", null, mclassdef))
                                        end
                                        ssection.add_child article
                                end
@@ -168,9 +168,9 @@ end
 
 redef class MClassPage
        redef fun apply_structure(v, doc) do
-               var section = new MEntitySection("{mentity.nitdoc_name}.section", mentity)
+               var section = new MEntitySection("{mentity.nitdoc_name}.section", null, mentity)
                root.add_child section
-               section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", mentity)
+               section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", null, mentity)
                var concerns = self.concerns
                if concerns == null or concerns.is_empty then return
                # FIXME diff hack
@@ -184,12 +184,12 @@ redef class MClassPage
                var constructors = new DocSection("{mentity.nitdoc_id}.constructors", "Constructors")
                var minit = mentity.root_init
                if minit != null then
-                       constructors.add_child new DefinitionArticle("{minit.nitdoc_id}.definition", minit)
+                       constructors.add_child new DefinitionArticle("{minit.nitdoc_id}.definition", null, minit)
                end
                section.add_child constructors
-               section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", mentity, concerns)
+               section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", null, mentity, concerns)
                for mentity in concerns do
-                       var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", mentity)
+                       var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", null, mentity)
                        if mentity isa MModule then
                                var mprops = mproperties_for(mentity)
                                var by_kind = new PropertiesByKind.with_elements(mprops)
@@ -200,10 +200,10 @@ redef class MClassPage
                                                        if mpropdef isa MMethodDef and mpropdef.mproperty.is_init then
                                                                if mpropdef == minit then continue
                                                                constructors.add_child new DefinitionArticle(
-                                                                       "{mpropdef.nitdoc_id}.definition", mpropdef)
+                                                                       "{mpropdef.nitdoc_id}.definition", null, mpropdef)
                                                        else
                                                                ssection.add_child new DefinitionArticle(
-                                                                       "{mpropdef.nitdoc_id}.definition", mpropdef)
+                                                                       "{mpropdef.nitdoc_id}.definition", null, mpropdef)
                                                        end
                                                end
                                        end
@@ -243,9 +243,9 @@ end
 
 redef class MPropertyPage
        redef fun apply_structure(v, doc) do
-               var section = new MEntitySection("{mentity.nitdoc_name}.section", mentity)
+               var section = new MEntitySection("{mentity.nitdoc_name}.section", null, mentity)
                root.add_child section
-               section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", mentity)
+               section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", null, mentity)
                var concerns = self.concerns
                if concerns == null or concerns.is_empty then return
                # FIXME diff hack
@@ -256,16 +256,16 @@ redef class MPropertyPage
                mentity.intro.mclassdef.mmodule.mgroup.mproject.booster_rank = 0
                mentity.intro.mclassdef.mmodule.mgroup.booster_rank = 0
                mentity.intro.mclassdef.mmodule.booster_rank = 0
-               section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", mentity, concerns)
+               section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", null, mentity, concerns)
                for mentity in concerns do
-                       var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", mentity)
+                       var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", null, mentity)
                        if mentity isa MModule then
                                # Add mproperties
                                var mpropdefs = mpropdefs_for(mentity).to_a
                                v.name_sorter.sort(mpropdefs)
                                for mpropdef in mpropdefs do
                                        ssection.add_child new DefinitionArticle(
-                                               "{mpropdef.nitdoc_id}.definition", mpropdef)
+                                               "{mpropdef.nitdoc_id}.definition", null, mpropdef)
                                end
                        end
                        section.add_child ssection
index a484659..3d3aa12 100644 (file)
@@ -874,85 +874,77 @@ redef class AMethPropdef
                else if cname == "Int" then
                        var recvval = args[0].to_i
                        if pname == "unary -" then
-                               return v.int_instance(-args[0].to_i)
+                               return v.int_instance(-recvval)
                        else if pname == "unary +" then
                                return args[0]
                        else if pname == "+" then
-                               return v.int_instance(args[0].to_i + args[1].to_i)
+                               return v.int_instance(recvval + args[1].to_i)
                        else if pname == "-" then
-                               return v.int_instance(args[0].to_i - args[1].to_i)
+                               return v.int_instance(recvval - args[1].to_i)
                        else if pname == "*" then
-                               return v.int_instance(args[0].to_i * args[1].to_i)
+                               return v.int_instance(recvval * args[1].to_i)
                        else if pname == "%" then
-                               return v.int_instance(args[0].to_i % args[1].to_i)
+                               return v.int_instance(recvval % args[1].to_i)
                        else if pname == "/" then
-                               return v.int_instance(args[0].to_i / args[1].to_i)
+                               return v.int_instance(recvval / args[1].to_i)
                        else if pname == "<" then
-                               return v.bool_instance(args[0].to_i < args[1].to_i)
+                               return v.bool_instance(recvval < args[1].to_i)
                        else if pname == ">" then
-                               return v.bool_instance(args[0].to_i > args[1].to_i)
+                               return v.bool_instance(recvval > args[1].to_i)
                        else if pname == "<=" then
-                               return v.bool_instance(args[0].to_i <= args[1].to_i)
+                               return v.bool_instance(recvval <= args[1].to_i)
                        else if pname == ">=" then
-                               return v.bool_instance(args[0].to_i >= args[1].to_i)
+                               return v.bool_instance(recvval >= args[1].to_i)
                        else if pname == "<=>" then
-                               return v.int_instance(args[0].to_i <=> args[1].to_i)
+                               return v.int_instance(recvval <=> args[1].to_i)
                        else if pname == "ascii" then
-                               return v.char_instance(args[0].to_i.ascii)
+                               return v.char_instance(recvval.ascii)
                        else if pname == "to_f" then
-                               return v.float_instance(args[0].to_i.to_f)
+                               return v.float_instance(recvval.to_f)
                        else if pname == "to_b" then
-                               return v.byte_instance(args[0].to_i.to_b)
-                       else if pname == "lshift" then
-                               return v.int_instance(args[0].to_i.lshift(args[1].to_i))
-                       else if pname == "rshift" then
-                               return v.int_instance(args[0].to_i.rshift(args[1].to_i))
+                               return v.byte_instance(recvval.to_b)
+                       else if pname == "<<" then
+                               return v.int_instance(recvval << args[1].to_i)
+                       else if pname == ">>" then
+                               return v.int_instance(recvval >> args[1].to_i)
                        else if pname == "rand" then
                                var res = recvval.rand
                                return v.int_instance(res)
-                       else if pname == "bin_and" then
-                               return v.int_instance(args[0].to_i.bin_and(args[1].to_i))
-                       else if pname == "bin_or" then
-                               return v.int_instance(args[0].to_i.bin_or(args[1].to_i))
-                       else if pname == "bin_xor" then
-                               return v.int_instance(args[0].to_i.bin_xor(args[1].to_i))
-                       else if pname == "bin_not" then
-                               return v.int_instance(args[0].to_i.bin_not)
                        end
                else if cname == "Byte" then
                        var recvval = args[0].to_b
                        if pname == "unary -" then
-                               return v.byte_instance(-args[0].to_b)
+                               return v.byte_instance(-recvval)
                        else if pname == "unary +" then
                                return args[0]
                        else if pname == "+" then
-                               return v.byte_instance(args[0].to_b + args[1].to_b)
+                               return v.byte_instance(recvval + args[1].to_b)
                        else if pname == "-" then
-                               return v.byte_instance(args[0].to_b - args[1].to_b)
+                               return v.byte_instance(recvval - args[1].to_b)
                        else if pname == "*" then
-                               return v.byte_instance(args[0].to_b * args[1].to_b)
+                               return v.byte_instance(recvval * args[1].to_b)
                        else if pname == "%" then
-                               return v.byte_instance(args[0].to_b % args[1].to_b)
+                               return v.byte_instance(recvval % args[1].to_b)
                        else if pname == "/" then
-                               return v.byte_instance(args[0].to_b / args[1].to_b)
+                               return v.byte_instance(recvval / args[1].to_b)
                        else if pname == "<" then
-                               return v.bool_instance(args[0].to_b < args[1].to_b)
+                               return v.bool_instance(recvval < args[1].to_b)
                        else if pname == ">" then
-                               return v.bool_instance(args[0].to_b > args[1].to_b)
+                               return v.bool_instance(recvval > args[1].to_b)
                        else if pname == "<=" then
-                               return v.bool_instance(args[0].to_b <= args[1].to_b)
+                               return v.bool_instance(recvval <= args[1].to_b)
                        else if pname == ">=" then
-                               return v.bool_instance(args[0].to_b >= args[1].to_b)
+                               return v.bool_instance(recvval >= args[1].to_b)
                        else if pname == "<=>" then
-                               return v.int_instance(args[0].to_b <=> args[1].to_b)
+                               return v.int_instance(recvval <=> args[1].to_b)
                        else if pname == "to_f" then
-                               return v.float_instance(args[0].to_b.to_f)
+                               return v.float_instance(recvval.to_f)
                        else if pname == "to_i" then
-                               return v.int_instance(args[0].to_b.to_i)
-                       else if pname == "lshift" then
-                               return v.byte_instance(args[0].to_b.lshift(args[1].to_i))
-                       else if pname == "rshift" then
-                               return v.byte_instance(args[0].to_b.rshift(args[1].to_i))
+                               return v.int_instance(recvval.to_i)
+                       else if pname == "<<" then
+                               return v.byte_instance(recvval << args[1].to_i)
+                       else if pname == ">>" then
+                               return v.byte_instance(recvval >> args[1].to_i)
                        else if pname == "byte_to_s_len" then
                                return v.int_instance(recvval.to_s.length)
                        end
index f0bfe8b..70c635e 100644 (file)
@@ -1813,22 +1813,6 @@ class MSignature
        # The number of parameters
        fun arity: Int do return mparameters.length
 
-       # The number of non-default parameters
-       #
-       # The number of default parameters is then `arity-min_arity`.
-       #
-       # Note that there cannot be both varargs and default prameters, thus
-       # if `vararg_rank != -1` then `min_arity` == `arity`
-       fun min_arity: Int
-       do
-               if vararg_rank != -1 then return arity
-               var res = 0
-               for p in mparameters do
-                       if not p.is_default then res += 1
-               end
-               return res
-       end
-
        redef fun to_s
        do
                var b = new FlatBuffer
@@ -1882,9 +1866,6 @@ class MParameter
        # Is the parameter a vararg?
        var is_vararg: Bool
 
-       # Is the parameter a default one?
-       var is_default: Bool
-
        redef fun to_s
        do
                if is_vararg then
@@ -1900,7 +1881,7 @@ class MParameter
        do
                if not self.mtype.need_anchor then return self
                var newtype = self.mtype.resolve_for(mtype, anchor, mmodule, cleanup_virtual)
-               var res = new MParameter(self.name, newtype, self.is_vararg, self.is_default)
+               var res = new MParameter(self.name, newtype, self.is_vararg)
                return res
        end
 
index 824ac8c..af3ae39 100644 (file)
@@ -186,7 +186,7 @@ redef class ModelBuilder
 
                                for param in sig.mparameters do
                                        var ret_type = param.mtype
-                                       var mparameter = new MParameter(param.name, ret_type, false, ret_type isa MNullableType)
+                                       var mparameter = new MParameter(param.name, ret_type, false)
                                        mparameters.add(mparameter)
                                end
                                initializers.add(npropdef.mpropdef.mproperty)
@@ -208,7 +208,7 @@ redef class ModelBuilder
                                var paramname = mreadpropdef.mproperty.name
                                var ret_type = mreadpropdef.msignature.return_mtype
                                if ret_type == null then return
-                               var mparameter = new MParameter(paramname, ret_type, false, ret_type isa MNullableType)
+                               var mparameter = new MParameter(paramname, ret_type, false)
                                mparameters.add(mparameter)
                                var msetter = npropdef.mwritepropdef
                                if msetter == null then
@@ -277,13 +277,7 @@ redef class ModelBuilder
                                if pd isa MMethodDef then
                                        # Get the signature resolved for the current receiver
                                        var sig = pd.msignature.resolve_for(mclassdef.mclass.mclass_type, mclassdef.bound_mtype, mclassdef.mmodule, false)
-                                       # Because the last parameter of setters is never default, try to default them for the autoinit.
-                                       for param in sig.mparameters do
-                                               if not param.is_default and param.mtype isa MNullableType then
-                                                       param = new MParameter(param.name, param.mtype, param.is_vararg, true)
-                                               end
-                                               mparameters.add(param)
-                                       end
+                                       mparameters.add_all(sig.mparameters)
                                else
                                        # TODO attributes?
                                        abort
@@ -954,13 +948,7 @@ redef class AMethPropdef
 
                var mparameters = new Array[MParameter]
                for i in [0..param_names.length[ do
-                       var is_default = false
-                       if vararg_rank == -1 and param_types[i] isa MNullableType then
-                               if i < param_names.length-1 or accept_special_last_parameter then
-                                       is_default = true
-                               end
-                       end
-                       var mparameter = new MParameter(param_names[i], param_types[i], i == vararg_rank, is_default)
+                       var mparameter = new MParameter(param_names[i], param_types[i], i == vararg_rank)
                        if nsig != null then nsig.n_params[i].mparameter = mparameter
                        mparameters.add(mparameter)
                end
@@ -1408,7 +1396,7 @@ redef class AAttrPropdef
                if mwritepropdef != null then
                        var name: String
                        name = n_id2.text
-                       var mparameter = new MParameter(name, mtype, false, false)
+                       var mparameter = new MParameter(name, mtype, false)
                        var msignature = new MSignature([mparameter], null)
                        mwritepropdef.msignature = msignature
                end
index 5e28695..79799e8 100644 (file)
@@ -845,7 +845,6 @@ class NeoModel
                node.labels.add "MParameter"
                node["name"] = mparameter.name
                node["is_vararg"] = mparameter.is_vararg
-               node["is_default"] = mparameter.is_default
                node.out_edges.add(new NeoEdge(node, "TYPE", to_node(mparameter.mtype)))
                return node
        end
@@ -861,8 +860,7 @@ class NeoModel
                var name = node["name"].to_s
                var mtype = to_mtype(model, node.out_nodes("TYPE").first)
                var is_vararg = node["is_vararg"].as(Bool)
-               var is_default = node["is_default"].as(Bool)
-               var mparameter = new MParameter(name, mtype, is_vararg, is_default)
+               var mparameter = new MParameter(name, mtype, is_vararg)
                mentities[node.id.as(Int)] = mparameter
                return mparameter
        end
index 7e3f7ff..9550339 100644 (file)
@@ -2199,7 +2199,7 @@ class AAmpExpr
 end
 
 # A unary operation on a method
-class AUnaryopExpr
+abstract class AUnaryopExpr
        super ASendExpr
 
        # The operator
index 41d2058..b5f5d0c 100644 (file)
@@ -414,26 +414,30 @@ private class TypeVisitor
                                return null
                        end
                else if args.length != msignature.arity then
-                       if msignature.arity == msignature.min_arity then
-                               modelbuilder.error(node, "Error: expected {msignature.arity} argument(s) for `{mproperty}{msignature}`; got {args.length}. See introduction at `{mproperty.full_name}`.")
-                               return null
-                       end
+                       # Too much argument
                        if args.length > msignature.arity then
-                               modelbuilder.error(node, "Error: expected at most {msignature.arity} argument(s) for `{mproperty}{msignature}`; got {args.length}. See introduction at `{mproperty.full_name}`.")
-                               return null
-                       end
-                       if args.length < msignature.min_arity then
-                               modelbuilder.error(node, "Error: expected at least {msignature.min_arity} argument(s) for `{mproperty}{msignature}`; got {args.length}. See introduction at `{mproperty.full_name}`.")
+                               modelbuilder.error(node, "Error: expected {msignature.arity} argument(s) for `{mproperty}{msignature}`; got {args.length}. See introduction at `{mproperty.full_name}`.")
                                return null
                        end
+                       # Other cases are managed later
                end
 
+
                #debug("CALL {unsafe_type}.{msignature}")
 
                # Associate each parameter to a position in the arguments
                var map = new SignatureMap
 
-               var setted = args.length - msignature.min_arity
+               # Special case for the isolated last argument
+               # TODO: reify this method characteristics (where? the param, the signature, the method?)
+               var last_is_padded = mproperty.name.chars.last == '='
+               var nbargs = args.length
+               if last_is_padded then
+                       nbargs -= 1
+                       assert not args.last isa ANamedargExpr
+                       map.map[msignature.arity - 1] = args.length - 1
+                       self.visit_expr_subtype(args.last, msignature.mparameters.last.mtype)
+               end
 
                # First, handle named arguments
                for i in [0..args.length[ do
@@ -445,10 +449,6 @@ private class TypeVisitor
                                modelbuilder.error(e.n_id, "Error: no parameter `{name}` for `{mproperty}{msignature}`.")
                                return null
                        end
-                       if not param.is_default then
-                               modelbuilder.error(e, "Error: parameter `{name}` is not optional for `{mproperty}{msignature}`.")
-                               return null
-                       end
                        var idx = msignature.mparameters.index_of(param)
                        var prev = map.map.get_or_null(idx)
                        if prev != null then
@@ -456,10 +456,12 @@ private class TypeVisitor
                                return null
                        end
                        map.map[idx] = i
-                       setted -= 1
                        e.mtype = self.visit_expr_subtype(e.n_expr, param.mtype)
                end
 
+               # Number of minimum mandatory remaining parameters
+               var min_arity = 0
+
                # Second, associate remaining parameters
                var vararg_decl = args.length - msignature.arity
                var j = 0
@@ -468,16 +470,16 @@ private class TypeVisitor
                        if map.map.has_key(i) then continue
 
                        var param = msignature.mparameters[i]
-                       if param.is_default then
-                               if setted > 0 then
-                                       setted -= 1
-                               else
-                                       continue
-                               end
-                       end
 
                        # Search the next free argument: skip named arguments since they are already associated
-                       while args[j] isa ANamedargExpr do j += 1
+                       while j < nbargs and args[j] isa ANamedargExpr do j += 1
+                       if j >= nbargs then
+                               if not param.mtype isa MNullableType then
+                                       min_arity = j + 1
+                               end
+                               j += 1
+                               continue
+                       end
                        var arg = args[j]
                        map.map[i] = j
                        j += 1
@@ -491,6 +493,16 @@ private class TypeVisitor
                        self.visit_expr_subtype(arg, paramtype)
                end
 
+               if min_arity > 0 then
+                       if last_is_padded then min_arity += 1
+                       if min_arity < msignature.arity then
+                               modelbuilder.error(node, "Error: expected at least {min_arity} argument(s) for `{mproperty}{msignature}`; got {args.length}. See introduction at `{mproperty.full_name}`.")
+                       else
+                               modelbuilder.error(node, "Error: expected {min_arity} argument(s) for `{mproperty}{msignature}`; got {args.length}. See introduction at `{mproperty.full_name}`.")
+                       end
+                       return null
+               end
+
                # Third, check varargs
                if vararg_rank >= 0 then
                        var paramtype = msignature.mparameters[vararg_rank].mtype
index 1272505..c762a8f 100644 (file)
@@ -3,3 +3,6 @@ android
 java
 jvm
 neo
+cocoa
+mpi
+emscripten
index 5a6f51c..f0883e3 100644 (file)
@@ -154,11 +154,14 @@ It is a failure, and analogous to the standard `fail`.
 
 `[todo] out/zzz_test_todo.res -> not yet implemented`
 
-The produced result file contains the magic string "NOT YET IMPLEMENTED".
+The produced result file contains a magic string, like `NOT YET IMPLEMENTED`.
 Those are considered the same as expected errors (like a fixme)
 It is a success.
 
-Some engines, libraries or program just print this to simplify the management of tests.
+The magic strings are listed in `todo` files in the root and `sav` directories.
+They are used by engines, libraries or program just print this to simplify the management of tests.
+
+Magic strings are used with `grep -f`, so each line is a pattern that is searched within the res files.
 
 ### Skipped
 
index 2d1af37..d4de4ed 100644 (file)
@@ -80,8 +80,8 @@ var x
 
 #alt1#a.foo
 #alt1#a.foo(2)
-a.foo(1,2)
-a.foo(1,2,3)
+#alt1#a.foo(1,2)
+#alt1#a.foo(1,2,3)
 a.foo(1,2,3,4)
 a.foo(1,2,3,4,5)
 a.foo(1,2,3,4,5,6)
index 6ea74cf..f5f4622 100644 (file)
@@ -71,11 +71,11 @@ a.foo
 #alt1#a = new B(1)
 #alt1#a.foo
 
-a = new B(1,4)
-a.foo
+#alt1#a = new B(1,4)
+#alt1#a.foo
 
-a = new B(1,2,4)
-a.foo
+#alt1#a = new B(1,2,4)
+#alt1#a.foo
 
 a = new B(1,2,3,4)
 a.foo
@@ -86,8 +86,8 @@ a.foo
 #alt1#a = new C(1)
 #alt1#a.foo
 
-a = new C(4,1)
-a.foo
+#alt1#a = new C(4,1)
+#alt1#a.foo
 
 a = new C(3,4,1)
 a.foo
index a584add..e82ca07 100644 (file)
 import base_arg_default
 
 var a = new A
+a.foo(a=1,b=2,c=3,d=4,e=5,f=6)
 a.foo(a=1,b=2,3,4,e=5,f=6)
 a.foo(f=6,3,e=5,b=2,4,a=1)
-a.foo(3,e=5,b=2,4)
+a.foo(f=6,d=4,e=5,b=2,c=3,a=1)
+#alt1#a.foo(3,e=5,b=2,4)
 
 a.bar
 
@@ -43,4 +45,3 @@ a.bar(b=2,a=1,c=3)
 #alt1#a.bar(2,a=1,3, 4)
 #alt1#a.bar(fail=1)
 #alt1#a.bar(a=1,a=1)
-#alt1#a.foo(c=1,d=1)
index 22f62f0..76d8ce1 100644 (file)
@@ -26,9 +26,9 @@ end
 var a = new A #alt1# var a = new B
 a.foo(a=1,b=2,3,4,e=5,f=6)
 a.foo(f=6,3,e=5,b=2,4,a=1)
-a.foo(3,e=5,b=2,4)
+#alt3#a.foo(3,e=5,b=2,4)
 
 var b = new B #alt1# var b = new A
 b.foo(x=1,y=2,3,4,u=5,v=6)
 b.foo(v=6,3,u=5,y=2,4,x=1)
-b.foo(3,u=5,y=2,4)
+#alt3#b.foo(3,u=5,y=2,4)
index a948eeb..9558e13 100644 (file)
@@ -33,10 +33,10 @@ end
 
 var a = new A
 a.foo(order(1),order(2),order(3),order(4),order(5),order(6))
+a.foo(a=order(1),b=order(2),c=order(3),d=order(4),e=order(5),f=order(6))
 a.foo(a=order(1),b=order(2),order(3),order(4),e=order(5),f=order(6))
 a.foo(f=order(6),order(3),e=order(5),b=order(2),order(4),a=order(1))
-a.foo(order(3),e=order(5),b=order(2),order(4))
-a.foo(order(3),order(4))
+a.foo(f=order(6),d=order(4),e=order(5),b=order(2),c=order(3),a=order(1))
 
 bar(order(1),order(2),order(3))
 bar(order(1),order(2),order(3),order(4))
index 0c9bc5e..35373c7 100644 (file)
@@ -17,7 +17,7 @@
 var n = 10
 if args.not_empty then n = args.first.to_i
 
-var nn = 1.lshift(n)
+var nn = 1 << n
 
 var a = new Array[Numeric]
 var b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
index 2fc5a8a..c226df9 100644 (file)
@@ -72,7 +72,7 @@ var long_lived_tree = bottom_up_tree(0, max_depth)
 
 var depth = min_depth
 while depth <= max_depth do
-       var iterations = 1.lshift(max_depth - depth + min_depth)
+       var iterations = 1 << (max_depth - depth + min_depth)
        var check_res = 0
 
        for i in [1..(iterations+1)[ do
index 0e13e59..6531814 100644 (file)
@@ -272,6 +272,6 @@ if not args.is_empty then
        nb = args.first.to_i
 end
 
-s.run_for(1.lshift(nb))
+s.run_for(1 << nb)
 print(c1.count)
 
index 634e3cb..a5e13ce 100644 (file)
@@ -38,7 +38,7 @@ end
 
 fun test(n: Int)
 do
-       var m = 1000.lshift(n)
+       var m = 1000 << n
        print("Primes up to {m} {nsieve(m)}")
 end
 
index d3c1b7c..0937117 100644 (file)
@@ -104,7 +104,7 @@ var i = 0
 var n = 10
 if args.not_empty then n = args.first.to_i
 
-while i < 1.lshift(n) do
+while i < 1 << n do
        a.hop(b, c, d)
        i = i + 1
 end
index a4f53ad..6e70969 100644 (file)
@@ -67,7 +67,7 @@ for i in [0..(nb/6)[ do
        a[i*6+4] = new E
        a[i*6+5] = new F
 end
-for i in [0..1.lshift(n)[ do
+for i in [0..1 << n[ do
        for j in [0..nb[ do
                a[j].foo
        end
diff --git a/tests/sav/Darwin/test_regex_check_alt1.res b/tests/sav/Darwin/test_regex_check_alt1.res
new file mode 100644 (file)
index 0000000..1853abe
--- /dev/null
@@ -0,0 +1 @@
+alt/test_regex_check_alt1.nit:16,10--18: Regex Error: repetition-operator operand invalid
diff --git a/tests/sav/Darwin/test_regex_check_alt2.res b/tests/sav/Darwin/test_regex_check_alt2.res
new file mode 100644 (file)
index 0000000..96faab5
--- /dev/null
@@ -0,0 +1 @@
+alt/test_regex_check_alt2.nit:17,10--19: Regex Error: parentheses not balanced
diff --git a/tests/sav/Darwin/test_regex_check_alt3.res b/tests/sav/Darwin/test_regex_check_alt3.res
new file mode 100644 (file)
index 0000000..122e76d
--- /dev/null
@@ -0,0 +1 @@
+alt/test_regex_check_alt3.nit:18,10--19: Regex Error: brackets ([ ]) not balanced
diff --git a/tests/sav/Darwin/todo b/tests/sav/Darwin/todo
new file mode 100644 (file)
index 0000000..afb008a
--- /dev/null
@@ -0,0 +1,5 @@
+fatal error: 'endian.h' file not found
+Error: package `glesv1_cm` unknown by `pkg-config`, make sure the development package is be installed
+Error: package `glesv2` unknown by `pkg-config`, make sure the development package is be installed
+fatal error: 'libintl.h' file not found
+ld: unknown option: -soname
index 61ea614..56ee59c 100644 (file)
@@ -1,17 +1,3 @@
-
-
-1
-2
-
-
--
-1
-
-2
-3
-
-
--
 1
 2
 3
index fba2f2b..40dd13d 100644 (file)
@@ -1,6 +1,8 @@
-alt/base_arg_default_alt1.nit:81,3--5: Error: expected at least 2 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 0. See introduction at `base_arg_default_alt1::A::foo`.
-alt/base_arg_default_alt1.nit:82,3--5: Error: expected at least 2 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 1. See introduction at `base_arg_default_alt1::A::foo`.
-alt/base_arg_default_alt1.nit:88,3--5: Error: expected at most 6 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 7. See introduction at `base_arg_default_alt1::A::foo`.
-alt/base_arg_default_alt1.nit:94,3--5: Error: expected at most 3 argument(s) for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`; got 4. See introduction at `base_arg_default_alt1::A::bar`.
-alt/base_arg_default_alt1.nit:99,3--5: Error: expected at most 3 argument(s) for `bar=(a: nullable Int, b: nullable Int, c: nullable Int)`; got 4. See introduction at `base_arg_default_alt1::A::bar=`.
-alt/base_arg_default_alt1.nit:110,1--13: Error: expected at most 3 argument(s) for `[]=(a: nullable Int, b: nullable Int, c: nullable Int): Int`; got 4. See introduction at `base_arg_default_alt1::A::[]=`.
+alt/base_arg_default_alt1.nit:81,3--5: Error: expected at least 4 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 0. See introduction at `base_arg_default_alt1::A::foo`.
+alt/base_arg_default_alt1.nit:82,3--5: Error: expected at least 4 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 1. See introduction at `base_arg_default_alt1::A::foo`.
+alt/base_arg_default_alt1.nit:83,3--5: Error: expected at least 4 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 2. See introduction at `base_arg_default_alt1::A::foo`.
+alt/base_arg_default_alt1.nit:84,3--5: Error: expected at least 4 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 3. See introduction at `base_arg_default_alt1::A::foo`.
+alt/base_arg_default_alt1.nit:88,3--5: Error: expected 6 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 7. See introduction at `base_arg_default_alt1::A::foo`.
+alt/base_arg_default_alt1.nit:94,3--5: Error: expected 3 argument(s) for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`; got 4. See introduction at `base_arg_default_alt1::A::bar`.
+alt/base_arg_default_alt1.nit:99,3--5: Error: expected 3 argument(s) for `bar=(a: nullable Int, b: nullable Int, c: nullable Int)`; got 4. See introduction at `base_arg_default_alt1::A::bar=`.
+alt/base_arg_default_alt1.nit:110,1--13: Error: expected 3 argument(s) for `[]=(a: nullable Int, b: nullable Int, c: nullable Int): Int`; got 4. See introduction at `base_arg_default_alt1::A::[]=`.
index 437e8ee..289d97c 100644 (file)
@@ -6,26 +6,11 @@
 2
 -
 1
-4
--
-1
-2
-4
--
-1
 2
 3
 4
 -
 1
  
-4
--
-1
 3
 4
index cdf6690..ccec709 100644 (file)
@@ -1,6 +1,9 @@
 alt/base_arg_default_autoinit_alt1.nit:59,5--7: Error: expected at least 1 argument(s) for `init(mandatory: Int, optional: nullable Int)`; got 0. See introduction at `standard::Object::init`.
-alt/base_arg_default_autoinit_alt1.nit:68,5--7: Error: expected at most 2 argument(s) for `init(mandatory: Int, optional: nullable Int)`; got 3. See introduction at `standard::Object::init`.
-alt/base_arg_default_autoinit_alt1.nit:71,5--7: Error: expected at least 2 argument(s) for `init(mandatory: Int, optional: nullable Int, optional_b: nullable Int, mandatory_b: Int)`; got 1. See introduction at `standard::Object::init`.
-alt/base_arg_default_autoinit_alt1.nit:83,5--7: Error: expected at most 4 argument(s) for `init(mandatory: Int, optional: nullable Int, optional_b: nullable Int, mandatory_b: Int)`; got 5. See introduction at `standard::Object::init`.
-alt/base_arg_default_autoinit_alt1.nit:86,5--7: Error: expected at least 2 argument(s) for `init(optional_b: nullable Int, mandatory_b: Int, mandatory: Int)`; got 1. See introduction at `standard::Object::init`.
-alt/base_arg_default_autoinit_alt1.nit:95,5--7: Error: expected at most 3 argument(s) for `init(optional_b: nullable Int, mandatory_b: Int, mandatory: Int)`; got 4. See introduction at `standard::Object::init`.
+alt/base_arg_default_autoinit_alt1.nit:68,5--7: Error: expected 2 argument(s) for `init(mandatory: Int, optional: nullable Int)`; got 3. See introduction at `standard::Object::init`.
+alt/base_arg_default_autoinit_alt1.nit:71,5--7: Error: expected 4 argument(s) for `init(mandatory: Int, optional: nullable Int, optional_b: nullable Int, mandatory_b: Int)`; got 1. See introduction at `standard::Object::init`.
+alt/base_arg_default_autoinit_alt1.nit:74,5--7: Error: expected 4 argument(s) for `init(mandatory: Int, optional: nullable Int, optional_b: nullable Int, mandatory_b: Int)`; got 2. See introduction at `standard::Object::init`.
+alt/base_arg_default_autoinit_alt1.nit:77,5--7: Error: expected 4 argument(s) for `init(mandatory: Int, optional: nullable Int, optional_b: nullable Int, mandatory_b: Int)`; got 3. See introduction at `standard::Object::init`.
+alt/base_arg_default_autoinit_alt1.nit:83,5--7: Error: expected 4 argument(s) for `init(mandatory: Int, optional: nullable Int, optional_b: nullable Int, mandatory_b: Int)`; got 5. See introduction at `standard::Object::init`.
+alt/base_arg_default_autoinit_alt1.nit:86,5--7: Error: expected 3 argument(s) for `init(optional_b: nullable Int, mandatory_b: Int, mandatory: Int)`; got 1. See introduction at `standard::Object::init`.
+alt/base_arg_default_autoinit_alt1.nit:89,5--7: Error: expected 3 argument(s) for `init(optional_b: nullable Int, mandatory_b: Int, mandatory: Int)`; got 2. See introduction at `standard::Object::init`.
+alt/base_arg_default_autoinit_alt1.nit:95,5--7: Error: expected 3 argument(s) for `init(optional_b: nullable Int, mandatory_b: Int, mandatory: Int)`; got 4. See introduction at `standard::Object::init`.
index be2e49f..f31da85 100644 (file)
 5
 6
 -
-
+1
 2
 3
 4
 5
-
+6
+-
+1
+2
+3
+4
+5
+6
 -
 
 
index f41b60a..39b6ba4 100644 (file)
@@ -1,4 +1,4 @@
-alt/base_arg_named_alt1.nit:43,3--5: Error: expected at most 3 argument(s) for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`; got 4. See introduction at `base_arg_default::A::bar`.
-alt/base_arg_named_alt1.nit:44,7--10: Error: no parameter `fail` for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`.
-alt/base_arg_named_alt1.nit:45,11--13: Error: parameter `a` already associated with argument #0 for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`.
-alt/base_arg_named_alt1.nit:46,7--9: Error: parameter `c` is not optional for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`.
+alt/base_arg_named_alt1.nit:22,3--5: Error: expected at least 5 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 4. See introduction at `base_arg_default::A::foo`.
+alt/base_arg_named_alt1.nit:45,3--5: Error: expected 3 argument(s) for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`; got 4. See introduction at `base_arg_default::A::bar`.
+alt/base_arg_named_alt1.nit:46,7--10: Error: no parameter `fail` for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`.
+alt/base_arg_named_alt1.nit:47,11--13: Error: parameter `a` already associated with argument #0 for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`.
index 17a46de..6be7ca2 100644 (file)
 5
 6
 -
-
-2
-3
-4
-5
-
--
 1
 2
 3
 5
 6
 -
-
-2
-3
-4
-5
-
--
index aa69f50..20528d9 100644 (file)
@@ -1,6 +1,4 @@
 alt/base_arg_named_inherit_alt1.nit:27,7: Error: no parameter `a` for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`.
 alt/base_arg_named_inherit_alt1.nit:28,7: Error: no parameter `f` for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`.
-alt/base_arg_named_inherit_alt1.nit:29,9: Error: no parameter `e` for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`.
 alt/base_arg_named_inherit_alt1.nit:32,7: Error: no parameter `x` for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`.
 alt/base_arg_named_inherit_alt1.nit:33,7: Error: no parameter `v` for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`.
-alt/base_arg_named_inherit_alt1.nit:34,9: Error: no parameter `u` for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`.
index 2a85022..29bba0d 100644 (file)
@@ -1,3 +1,2 @@
 alt/base_arg_named_inherit_alt2.nit:27,7: Error: no parameter `a` for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`.
 alt/base_arg_named_inherit_alt2.nit:28,7: Error: no parameter `f` for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`.
-alt/base_arg_named_inherit_alt2.nit:29,9: Error: no parameter `e` for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`.
diff --git a/tests/sav/base_arg_named_inherit_alt3.res b/tests/sav/base_arg_named_inherit_alt3.res
new file mode 100644 (file)
index 0000000..46dfc27
--- /dev/null
@@ -0,0 +1,2 @@
+alt/base_arg_named_inherit_alt3.nit:29,3--5: Error: expected at least 5 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 4. See introduction at `base_arg_default::A::foo`.
+alt/base_arg_named_inherit_alt3.nit:34,3--5: Error: expected at least 5 argument(s) for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`; got 4. See introduction at `base_arg_default::A::foo`.
index b16bf3f..7ed6845 100644 (file)
 5
 6
 -
->6
->3
->5
+>1
 >2
+>3
 >4
->1
+>5
+>6
 1
 2
 3
 5
 6
 -
+>6
 >3
 >5
 >2
 >4
-
+>1
+1
 2
 3
 4
 5
-
+6
 -
->3
+>6
 >4
-
-
+>5
+>2
+>3
+>1
+1
+2
 3
 4
-
-
+5
+6
 -
 >1
 >2
index a1946e2..aca97d0 100644 (file)
@@ -6,7 +6,7 @@
 ../lib/standard/kernel.nit:431,1--486,3: Error: `kernel#Numeric` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
 ../lib/standard/kernel.nit:492,1--515,3: Error: `kernel#Bool` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
 ../lib/standard/kernel.nit:517,1--599,3: Error: `kernel#Float` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
-../lib/standard/kernel.nit:601,1--703,3: Error: `kernel#Byte` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
-../lib/standard/kernel.nit:705,1--896,3: Error: `kernel#Int` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
-../lib/standard/kernel.nit:898,1--1051,3: Error: `kernel#Char` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
-../lib/standard/kernel.nit:1053,1--1060,3: Error: `kernel#Pointer` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:601,1--697,3: Error: `kernel#Byte` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:699,1--884,3: Error: `kernel#Int` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:886,1--1039,3: Error: `kernel#Char` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
+../lib/standard/kernel.nit:1041,1--1048,3: Error: `kernel#Pointer` does not specialize `module_0#Object`. Possible duplication of the root class `Object`?
index e462629..ed63849 100644 (file)
@@ -1,4 +1,4 @@
-Runtime error: Cast failed. Expected `OTHER`, got `Float` (../lib/standard/kernel.nit:726)
+Runtime error: Cast failed. Expected `OTHER`, got `Float` (../lib/standard/kernel.nit:720)
 11
 21
 31
index e462629..ed63849 100644 (file)
@@ -1,4 +1,4 @@
-Runtime error: Cast failed. Expected `OTHER`, got `Float` (../lib/standard/kernel.nit:726)
+Runtime error: Cast failed. Expected `OTHER`, got `Float` (../lib/standard/kernel.nit:720)
 11
 21
 31
index e462629..ed63849 100644 (file)
@@ -1,4 +1,4 @@
-Runtime error: Cast failed. Expected `OTHER`, got `Float` (../lib/standard/kernel.nit:726)
+Runtime error: Cast failed. Expected `OTHER`, got `Float` (../lib/standard/kernel.nit:720)
 11
 21
 31
index 33e2d20..6584bce 100644 (file)
@@ -51,13 +51,13 @@ Float [
 Numeric -> Float [dir=back arrowtail=open style=dashed];
 
 Byte [
- label = "{Byte||+ %(i: Byte): Byte\l+ lshift(i: Int): Byte\l+ \<\<(i: Int): Byte\l+ rshift(i: Int): Byte\l+ \>\>(i: Int): Byte\l}"
+ label = "{Byte||+ %(i: Byte): Byte\l+ \<\<(i: Int): Byte\l+ \>\>(i: Int): Byte\l}"
 ]
 Discrete -> Byte [dir=back arrowtail=open style=dashed];
 Numeric -> Byte [dir=back arrowtail=open style=dashed];
 
 Int [
- label = "{Int||+ %(i: Int): Int\l+ lshift(i: Int): Int\l+ \<\<(i: Int): Int\l+ rshift(i: Int): Int\l+ \>\>(i: Int): Int\l+ ascii(): Char\l+ digit_count(b: Int): Int\l+ digit_count_base_10(): Int\l+ to_c(): Char\l+ abs(): Int\l}"
+ label = "{Int||+ %(i: Int): Int\l+ \<\<(i: Int): Int\l+ \>\>(i: Int): Int\l+ ascii(): Char\l+ digit_count(b: Int): Int\l+ digit_count_base_10(): Int\l+ to_c(): Char\l+ abs(): Int\l}"
 ]
 Discrete -> Int [dir=back arrowtail=open style=dashed];
 Numeric -> Int [dir=back arrowtail=open style=dashed];
index 8fc87eb..90afcec 100644 (file)
@@ -51,13 +51,13 @@ Float [
 Numeric -> Float [dir=back arrowtail=open style=dashed];
 
 Byte [
- label = "{Byte||+ %(i: Byte): Byte\l+ lshift(i: Int): Byte\l+ \<\<(i: Int): Byte\l+ rshift(i: Int): Byte\l+ \>\>(i: Int): Byte\l}"
+ label = "{Byte||+ %(i: Byte): Byte\l+ \<\<(i: Int): Byte\l+ \>\>(i: Int): Byte\l}"
 ]
 Discrete -> Byte [dir=back arrowtail=open style=dashed];
 Numeric -> Byte [dir=back arrowtail=open style=dashed];
 
 Int [
- label = "{Int||+ %(i: Int): Int\l+ lshift(i: Int): Int\l+ \<\<(i: Int): Int\l+ rshift(i: Int): Int\l+ \>\>(i: Int): Int\l+ ascii(): Char\l+ digit_count(b: Int): Int\l+ digit_count_base_10(): Int\l+ to_c(): Char\l+ abs(): Int\l}"
+ label = "{Int||+ %(i: Int): Int\l+ \<\<(i: Int): Int\l+ \>\>(i: Int): Int\l+ ascii(): Char\l+ digit_count(b: Int): Int\l+ digit_count_base_10(): Int\l+ to_c(): Char\l+ abs(): Int\l}"
 ]
 Discrete -> Int [dir=back arrowtail=open style=dashed];
 Numeric -> Int [dir=back arrowtail=open style=dashed];
index fc9141f..4575526 100644 (file)
@@ -1,22 +1,11 @@
 5
 5
 0
-5
-5
-0
-0
-5
-5
 0
 5
 5
 -1
--1
 0x05
 0x05
 0x00
-0x05
-0x05
-0x00
-0xfa
 0xfa
index a171b58..5eea74f 100644 (file)
@@ -75,7 +75,7 @@ var long_lived_tree = bottom_up_tree(0, max_depth)
 
 var depth = min_depth
 while depth <= max_depth do
-    var iterations = 1.lshift(max_depth - depth + min_depth)
+    var iterations = 1 << (max_depth - depth + min_depth)
     var check_res = 0
 
     for i in [1..(iterations+1)[ do
index f51a3d8..7970971 100644 (file)
@@ -54,9 +54,9 @@ for y in [0..h[ do
        end
 
        if zr*zr+zi*zi > limit*limit then
-           byte_acc = (byte_acc.lshift(1))
+           byte_acc = byte_acc << 1
        else
-           byte_acc = (byte_acc.lshift(1)) + 1u8
+           byte_acc = (byte_acc << 1) + 1u8
        end
 
        bit_num = bit_num + 1
@@ -66,7 +66,7 @@ for y in [0..h[ do
            byte_acc = 0u8
            bit_num = 0     
        else if x == w - 1 then
-           byte_acc = byte_acc.lshift(8-w%8)
+           byte_acc = byte_acc << (8-w%8)
            stdout.write_byte(byte_acc)
            byte_acc = 0u8
            bit_num = 0     
index 109b70f..1e7eda6 100644 (file)
@@ -59,7 +59,7 @@ end
 
 fun test(n: Int)
 do
-       var m = 10000.lshift(n)
+       var m = 10000 << n
        print("Primes up to {m} {nsieve(m)}")
 end
 
index ab5c703..b5ad0cb 100644 (file)
@@ -55,7 +55,7 @@ end
 
 fun test(n: Int)
 do
-       var m = 10000.lshift(n)
+       var m = 10000 << n
        print("Primes up to {m} {nsieve(m)}")
 end
 
index 3661e49..9806e3d 100644 (file)
@@ -1,9 +1,6 @@
 var a = 5
 var b = 5
 
-print a.bin_and(b) # 5
-print a.bin_or(b)  # 5
-print a.bin_xor(b) # 0
 print a & b
 print a | b
 print a ^ b
@@ -11,25 +8,17 @@ print a ^ b
 a = 0
 b = 5
 
-print a.bin_and(b) # 0
-print a.bin_or(b)  # 5
-print a.bin_xor(b) # 5
 print a & b
 print a | b
 print a ^ b
 
-print a.bin_not
 print ~a
 
 var c = 5u8
 var d = 5u8
 
-print c.bin_and(d) # 0
-print c.bin_or(d)  # 5
-print c.bin_xor(d) # 5
 print c & d
 print c | d
 print c ^ d
 
-print c.bin_not
 print ~c
index 6330517..768b698 100755 (executable)
@@ -260,7 +260,7 @@ function process_result()
                esac
        done
        OLD=`echo "$OLD" | sed -e 's/   */ /g' -e 's/^ //' -e 's/ $//'`
-       grep 'NOT YET IMPLEMENTED' "$outdir/$pattern.res" >/dev/null
+       istodo  "$outdir/$pattern.res"
        NYI="$?"
        if [ -n "$SAV" ]; then
                if [ -n "$OLD" ]; then
@@ -404,6 +404,20 @@ skip_cc()
        return 1
 }
 
+# Check that the resfile ($1) matches some magic strings in `todo` files.
+istodo()
+{
+       test "$no" = true && return 1
+       for savdir in $savdirs .; do
+               local f="$savdir/todo"
+               test -f "$f" || continue
+               if grep -f "$f" "$1" >/dev/null 2>&1; then
+                       return 0
+               fi
+       done
+       return 1
+}
+
 find_nitc()
 {
        local name="$enginebinname"
diff --git a/tests/todo b/tests/todo
new file mode 100644 (file)
index 0000000..78d51cc
--- /dev/null
@@ -0,0 +1 @@
+NOT YET IMPLEMENTED