#
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
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
# 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
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
# 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
# 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
end
# Context related to an evocation of pathfinding
-class PathContext
+abstract class PathContext
serialize
# Type of the nodes in `graph`
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?
# # 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
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)
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
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
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
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
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
# 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
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)
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
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
import nitcorn
# A nitcorn listener for Github hooks.
-class HookListener
+abstract class HookListener
# Api client used to perform Github API requests.
var api: GithubAPI
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
# 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
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
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)
# 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
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
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
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
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
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
# 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]
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)
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
# 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
#
# 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
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
# 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`
#
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 ?
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
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
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
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]
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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)
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
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
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
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
# 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
# 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
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
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)
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
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
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
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
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
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
end
# A unary operation on a method
-class AUnaryopExpr
+abstract class AUnaryopExpr
super ASendExpr
# The operator
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
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
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
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
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
java
jvm
neo
+cocoa
+mpi
+emscripten
`[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
#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)
#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
#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
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
#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)
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)
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))
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]
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
nb = args.first.to_i
end
-s.run_for(1.lshift(nb))
+s.run_for(1 << nb)
print(c1.count)
fun test(n: Int)
do
- var m = 1000.lshift(n)
+ var m = 1000 << n
print("Primes up to {m} {nsieve(m)}")
end
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
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
--- /dev/null
+alt/test_regex_check_alt1.nit:16,10--18: Regex Error: repetition-operator operand invalid
--- /dev/null
+alt/test_regex_check_alt2.nit:17,10--19: Regex Error: parentheses not balanced
--- /dev/null
+alt/test_regex_check_alt3.nit:18,10--19: Regex Error: brackets ([ ]) not balanced
--- /dev/null
+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
-
-
-1
-2
-
-
--
-1
-
-2
-3
-
-
--
1
2
3
-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::[]=`.
2
-
1
-
-
-4
--
-1
-2
-
-4
--
-1
2
3
4
-
1
-
-4
--
-1
-
3
4
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`.
5
6
-
-
+1
2
3
4
5
-
+6
+-
+1
+2
+3
+4
+5
+6
-
-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)`.
5
6
-
-
-2
-3
-4
-5
-
--
1
2
3
5
6
-
-
-2
-3
-4
-5
-
--
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)`.
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)`.
--- /dev/null
+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`.
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
../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`?
-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
-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
-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
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];
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];
5
5
0
-5
-5
-0
-0
-5
-5
0
5
5
-1
--1
0x05
0x05
0x00
-0x05
-0x05
-0x00
-0xfa
0xfa
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
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
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
fun test(n: Int)
do
- var m = 10000.lshift(n)
+ var m = 10000 << n
print("Primes up to {m} {nsieve(m)}")
end
fun test(n: Int)
do
- var m = 10000.lshift(n)
+ var m = 10000 << n
print("Primes up to {m} {nsieve(m)}")
end
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
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
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
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"
--- /dev/null
+NOT YET IMPLEMENTED