compiler is more robust.
The only issue seems to be the Makefile since there is no way to have an arbitrary named goal.
Pull-Request: #899
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
var mname = request.string_arg("meetup_name")
var mdate = request.string_arg("meetup_date")
var mplace = request.string_arg("meetup_place")
+ var mmodestr = request.string_arg("meetup_mode")
+ var mmode = 0
if mdate == null then mdate = ""
if mplace == null then mplace = ""
+ if mmodestr != null then
+ mmode = 1
+ end
if mname == null then
mname = ""
var rsp = new HttpResponse(200)
var meetpage = new MeetupCreationPage
- var meet = new Meetup(mname, mdate, mplace)
+ var meet = new Meetup(mname, mdate, mplace, mmode)
meetpage.ans = ansset
meetpage.meet = meet
meetpage.error = "'Meetup name' is a mandatory fields."
end
var db = new OpportunityDB.open(db_path)
- var meet = new Meetup(mname, mdate, mplace)
+ var meet = new Meetup(mname, mdate, mplace, mmode)
if ansset.is_empty then
db.close
var rsp = new HttpResponse(200)
redef fun answer(request, uri) do
var persid = request.int_arg("pers_id")
var ansid = request.int_arg("answer_id")
- var ans = request.bool_arg("answer")
+ var ans = request.int_arg("answer")
if persid == null or ansid == null or ans == null then return bad_req
var db = new OpportunityDB.open(db_path)
db.change_answer(ansid, persid, ans)
var ans = request.string_arg("answers").split("&")
if name == null or m_id == null then return bad_req
print ans
- var ansmap = new HashMap[Int, Bool]
+ var ansmap = new HashMap[Int, Int]
for i in ans do
var mp = i.split("=")
- var b = false
- if mp.last == "true" then b = true
var id = mp.first.split("_").last
+ var b = mp.last.to_i
if not id.is_numeric then continue
ansmap[id.to_i] = b
end
var p = new People(rname, rsurname)
for i in m.answers(db) do
if not ansmap.has_key(i.id) then
- p.answers[i] = false
+ p.answers[i] = 0
else
p.answers[i] = ansmap[i.id]
end
# Creates the tables and triggers for Opportunity (SQLite3 DB)
fun create_db do
- assert create_table("IF NOT EXISTS meetups (id CHAR(40) PRIMARY KEY, name TEXT, date TEXT, place TEXT);") else
+ assert create_table("IF NOT EXISTS meetups (id CHAR(40) PRIMARY KEY, name TEXT, date TEXT, place TEXT, answer_mode INTEGER DEFAULT 0);") else
print error or else "?"
end
assert create_table("IF NOT EXISTS people(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, surname TEXT);") else
fun find_meetup_by_id(id: String): nullable Meetup do
var req = select("* FROM meetups where id={id.to_sql_string};")
for i in req do
- return new Meetup.from_db(i[0].to_s, i[1].to_s, i[2].to_s, i[3].to_s)
+ return new Meetup.from_db(i[0].to_s, i[1].to_s, i[2].to_s, i[3].to_s, i[4].to_i)
+ end
+ return null
+ end
+
+ # Find an `Answer` by its `id` or `null` if it could not be found
+ fun find_answer_by_id(id: Int): nullable Answer do
+ var req = select("* FROM answers WHERE id={id};")
+ for i in req do
+ return new Answer.from_db(i[0].to_i, i[2].to_s)
end
return null
end
# Change an Answer `ansid` for someone with an id `pid` to `resp`
#
# Returns `true` if the request was sucessful, false otherwise
- fun change_answer(pid: Int, ansid: Int, resp: Bool): Bool do
- var rsp = 0
- if resp then rsp = 1
- var rq = execute("INSERT OR REPLACE INTO part_answers(id_part, id_ans, value) VALUES({pid},{ansid},{rsp});")
- if not rq then
+ fun change_answer(pid: Int, ansid: Int, resp: Int): Bool do
+ var p = find_people_by_id(pid)
+ if p == null then
print "Error while updating answer {ansid}:{pid}"
- print error or else "Unknown error"
return false
end
- return true
+ var a = find_answer_by_id(ansid)
+ if a == null then
+ print "Error while updating answer {ansid}:{pid}"
+ return false
+ end
+ p.answers[a] = resp
+ if p.commit(self) then return true
+ return false
end
# Removes a person in the Database by its `id`
# Surname of the participant
var surname: String
# Map of the answers of a Meetup and the answers of the participant
- var answers: Map[Answer, Bool] = new HashMap[Answer, Bool]
+ # 0 = No
+ # 1 = Maybe
+ # 2 = Yes
+ var answers: Map[Answer, Int] = new HashMap[Answer, Int]
# To be used internally when fetching the `People` in Database
private init from_db(id: Int, name, surname: String) do
end
# Changes an answer `ans` (or adds it)
- fun answer=(ans: Answer, resp: Bool) do
+ fun answer=(ans: Answer, resp: Int) do
answers[ans] = resp
end
#
# NOTE: If `self` does not exist in the Database, no answers will be fetched
fun load_answers(db: OpportunityDB, meetup: Meetup) do
- self.answers = new HashMap[Answer, Bool]
- var req = db.select("answers.id, answers.name, part_answers.value FROM part_answers, answers WHERE part_answers.id_part={id} AND answers.id=part_answers.id_ans AND answers.meetup_id={meetup.id.to_sql_string} GROUP BY answers.id;")
+ self.answers = new HashMap[Answer, Int]
+ var req = db.select("answers.id, answers.name, part_answers.value FROM part_answers, answers WHERE part_answers.id_part={id} AND answers.id=part_answers.id_ans AND answers.meetup_id={meetup.id.html_escape.to_sql_string} GROUP BY answers.id;")
for i in req do
var ans = new Answer.from_db(i[0].to_i, i[1].to_s)
- answers[ans] = false
- if i[2].to_i == 1 then answers[ans] = true
+ answers[ans] = i[2].to_i
end
end
redef fun commit(db) do
if id == -1 then
- if not db.execute("INSERT INTO people (name,surname) VALUES ({name.to_sql_string}, {surname.to_sql_string});") then
+ if not db.execute("INSERT INTO people (name,surname) VALUES ({name.html_escape.to_sql_string}, {surname.html_escape.to_sql_string});") then
print "Error while adding people {self}"
print db.error or else "Unknown error"
return false
end
id = db.last_insert_rowid
else
- if not db.execute("UPDATE people SET name={name.to_sql_string}, surname={surname.to_sql_string} WHERE ID={id};") then
+ if not db.execute("UPDATE people SET name={name.html_escape.to_sql_string}, surname={surname.html_escape.to_sql_string} WHERE ID={id};") then
print "Error while updating people {self}"
print db.error or else "Unknown error"
return false
end
for i,j in answers do
if i.id == -1 then i.commit(db)
- var val = 0
- if j then val = 1
- if not db.execute("INSERT OR REPLACE INTO part_answers(id_part, id_ans, value) VALUES ({id},{i.id},{val});") then
- print("Error while adding/replacing part_answers {id}|{i.id}|{j}")
+ var val = j
+ var s = db.select("* FROM part_answers WHERE id_part={id} AND id_ans={i.id}")
+ if s != null and s.iterator.is_ok then
+ if not db.execute("UPDATE part_answers SET value={j} WHERE id_part={id} AND id_ans={i.id};") then
+ print "Error while updating part_answers {id}|{i.id} = {j}"
+ print db.error or else "Unknown error"
+ return false
+ end
+ continue
+ end
+ if not db.execute("INSERT INTO part_answers(id_part, id_ans, value) VALUES ({id},{i.id},{val});") then
+ print("Error while adding part_answers {id}|{i.id}|{j}")
print db.error or else "Unknown error"
return false
end
var date: String
# Place of the meetup
var place: String
+ # Mode of answering to the meetup (atm supports with or without Maybe)
+ var answer_mode: Int
# Builds the object with all the informations found in the database
- private init from_db(id, name, date, place: String) do
+ private init from_db(id, name, date, place: String, mode: Int) do
self.id = id
- self.name = name
- self.date = date
- self.place = place
+ init(name, date, place, mode)
end
# Gets the answers bound to the current `Meetup`
if id == "" then
var time = get_time
var tmpid = (name + date + place + time.to_s).sha1_to_s
- if not db.execute("INSERT INTO meetups (id, name, date, place) VALUES({tmpid.to_sql_string}, {name.to_sql_string}, {date.to_sql_string}, {place.to_sql_string});") then
+ if not db.execute("INSERT INTO meetups (id, name, date, place, answer_mode) VALUES({tmpid.to_sql_string}, {name.html_escape.to_sql_string}, {date.html_escape.to_sql_string}, {place.html_escape.to_sql_string}, {answer_mode});") then
print "Error recording entry Meetup {self}"
print db.error or else "Null error"
return false
id = tmpid
return true
else
- return db.execute("UPDATE meetups (name, date, place) VALUES({name.to_sql_string}, {date.to_sql_string}, {place.to_sql_string}) WHERE ID={id.to_sql_string};")
+ return db.execute("UPDATE meetups SET name={name.html_escape.to_sql_string}, date={date.html_escape.to_sql_string}, place={place.html_escape.to_sql_string}, answer_mode={answer_mode} WHERE ID={id.to_sql_string};")
end
end
self.id = id
end
+ redef fun hash do
+ if id != -1 then return id
+ return super
+ end
+
# Loads the Meetup associated to `self`
#
# REQUIRE: is loaded in database
assert id != -1
var res = db.select("meetups.* FROM meetups, answers WHERE answers.id={id} AND answers.meetup_id=meetups.id;")
for i in res do
- return new Meetup.from_db(i[0].to_s, i[1].to_s, i[2].to_s, i[3].to_s)
+ return new Meetup.from_db(i[0].to_s, i[1].to_s, i[2].to_s, i[3].to_s, i[4].to_i)
end
# If no Meetup could be loaded, the contract was not respected
abort
end
+ # Counts the number of positive or maybe answers
+ fun count(db: OpportunityDB): Int do
+ if id == -1 then return -1
+ var count = 0
+ var res = db.select("part_answers.value FROM part_answers WHERE part_answers.id_ans={id};")
+ if meetup == null then meetup = load_meetup(db)
+ for i in res do
+ if meetup.answer_mode == 0 then
+ count += i[0].to_i
+ else
+ if i[0].to_i == 2 then count += 1
+ end
+ end
+ return count
+ end
+
+ # Counts the score for this particular answer
+ fun score(db: OpportunityDB): Int do
+ if id == -1 then return -1
+ var score = 0
+ var res = db.select("part_answers.value FROM part_answers WHERE part_answers.id_ans={id};")
+ for i in res do
+ score += i[0].to_i
+ end
+ return score
+ end
+
redef fun commit(db) do
var m = meetup
if m == null then return false
end
end
if id == -1 then
- if not db.execute("INSERT INTO answers (name, meetup_id) VALUES({name.to_sql_string}, {m.id.to_sql_string});") then
+ if not db.execute("INSERT INTO answers (name, meetup_id) VALUES({name.html_escape.to_sql_string}, {m.id.to_sql_string});") then
print "Cannot create {self} in database"
print db.error or else "Unknown error"
return false
end
id = db.last_insert_rowid
else
- if not db.execute("UPDATE answers (name) VALUES ({name.to_sql_string}) WHERE meetup_id={m.id.to_sql_string};") then
+ if not db.execute("UPDATE answers SET name=({name.html_escape.to_sql_string}) WHERE meetup_id={m.id.to_sql_string};") then
print "Error updating {self} in database"
print db.error or else "Unknown error"
return false
# Meetup the page is supposed to show
var meetup: nullable Meetup = null
+ # Answer mode for the meetup
+ var mode = 0
init from_id(id: String) do
var db = new OpportunityDB.open("opportunity")
meetup = db.find_meetup_by_id(id)
db.close
+ if meetup != null then mode = meetup.answer_mode
+ init
end
init do
- header.page_js = """
+ header.page_js = "mode = {mode};\n"
+ header.page_js += """
+ function update_scores(){
+ var anss = $('.answer');
+ var count = {};
+ var scores = {};
+ var answers = [];
+ var maxscore = 0;
+ for(i=0; i < anss.length; i++){
+ var incscore = 0;
+ var inccount = 0;
+ var idparts = anss[i].id.split("_");
+ var ansid = idparts[1];
+ var html = anss[i].innerHTML;
+ if(html === "<center>✔</center>"){
+ inccount = 1;
+ incscore = 2;
+ }else if(html === "<center>❓</center>"){
+ incscore = 1;
+ }
+ var intansid = parseInt(ansid)
+ if(answers.indexOf(intansid) == -1){
+ answers.push(intansid);
+ }
+ if(ansid in count){
+ count[ansid] += inccount;
+ }else{
+ count[ansid] = inccount;
+ }
+ if(ansid in scores){
+ scores[ansid] += incscore;
+ }else{
+ scores[ansid] = incscore;
+ }
+ if(scores[ansid] > maxscore){
+ maxscore = scores[ansid];
+ }
+ }
+ for(i=0; i < answers.length; i++){
+ var ansid = answers[i].toString();
+ var el = $('#total'+ansid)[0];
+ var ins = "<center>"+count[ansid];
+ if(scores[ansid] >= maxscore){
+ ins += "<br/><span style=\\"color:blue\\">★</span>";
+ }
+ ins += "</center>";
+ el.innerHTML = ins;
+ }
+ }
function change_answer(ele, id){
// modify only the currently selected entry
if (in_modification_id != id) return;
var e = document.getElementById(ele.id);
var i = e.innerHTML;
- var ans = true;
+ var ans = true;"""
+ if mode == 0 then
+ header.page_js += """
if(i === "<center>✔</center>"){
- ans = false;
+ ans = 0;
e.innerHTML = "<center>✘</center>"
e.style.color = "red";
}else{
+ ans = 1;
e.innerHTML = "<center>✔</center>";
e.style.color = "green";
- }
+ }"""
+
+ else
+ header.page_js += """
+ if(i === "<center>✔</center>"){
+ ans = 1;
+ e.innerHTML = "<center>❓</center>"
+ e.style.color = "#B8860B";
+ }else if(i === "<center>❓</center>"){
+ ans = 0;
+ e.innerHTML = "<center>✘</center>"
+ e.style.color = "red";
+ }else{
+ ans = 2;
+ e.innerHTML = "<center>✔</center>";
+ e.style.color = "green";
+ }"""
+ end
+ header.page_js += """
var a = ele.id.split('_')
var pid = a[1]
var aid = a[2]
+ update_scores();
$.ajax({
type: "POST",
url: "./rest/answer",
}
function change_temp_answer(ele){
var e = document.getElementById(ele.id);
- var i = e.innerHTML;
- var ans = true;
+ var i = e.innerHTML;"""
+ if mode == 0 then
+ header.page_js += """
+ if(i === "<center>✔</center>"){
+ e.innerHTML = "<center>✘</center>"
+ e.style.color = "red";
+ }else{
+ e.innerHTML = "<center>✔</center>";
+ e.style.color = "green";
+ }
+ """
+ else
+ header.page_js += """
if(i === "<center>✔</center>"){
- ans = false;
- e.innerHTML = "<center>✘</center>";
+ e.innerHTML = "<center>❓</center>";
+ e.style.color = "#B8860B";
+ }else if(i === "<center>❓</center>"){
+ e.innerHTML = "<center>✘</center>"
e.style.color = "red";
}else{
e.innerHTML = "<center>✔</center>";
e.style.color = "green";
}
+ """
+ end
+ header.page_js += """
+ update_scores();
}
function add_part(ele){
var e = document.getElementById(ele.id);
ansmap = {};
for(i=0;i<ans.length;i++){
var curr = ans.eq(i)
+ """
+ if mode == 0 then
+ header.page_js += """
if(curr[0].innerHTML === "<center>✔</center>"){
- ansmap[curr.attr('id')] = true
+ ansmap[curr.attr('id')] = 1
}else{
- ansmap[curr.attr('id')] = false
- }
+ ansmap[curr.attr('id')] = 0
+ }"""
+ else
+ header.page_js += """
+ if(curr[0].innerHTML === "<center>✔</center>"){
+ ansmap[curr.attr('id')] = 2
+ }else if(curr[0].innerHTML === "<center>❓</center>"){
+ ansmap[curr.attr('id')] = 1
+ }else{
+ ansmap[curr.attr('id')] = 0
+ }"""
+ end
+ header.page_js += """
}
$.ajax({
type: "POST",
var arr = ele.id.split("_")
var pid = arr[1]
$('#' + ele.id).parent().parent().parent().remove();
+ update_scores();
$.ajax({
type: "POST",
url: "./rest/people",
}
});
}
-
// ID of line currently open for modification
var in_modification_id = null;
function modify_people(ele, id){
t.add "<td>"
t.add i.to_s
t.add "</td>"
- for j,k in i.answers do
+ for j, k in i.answers do
var color
- if k then
- color = "green"
- else color = "red"
-
+ if answer_mode == 0 then
+ if k == 1 then
+ color = "green"
+ else
+ color = "red"
+ end
+ else
+ if k == 2 then
+ color = "green"
+ else if k == 1 then
+ color = "#B8860B"
+ else
+ color = "red"
+ end
+ end
t.add """<td class="answer" onclick="change_answer(this, {{{i.id}}})" id="answer_{{{j.id}}}_{{{i.id}}}" style="color:{{{color}}}">"""
t.add "<center>"
- if k then
- t.add "✔"
+ if answer_mode == 0 then
+ if k == 1 then
+ t.add "✔"
+ else
+ t.add "✘"
+ end
else
- t.add "✘"
+ if k == 2 then
+ t.add "✔"
+ else if k == 1 then
+ t.add "❓"
+ else
+ t.add "✘"
+ end
end
t.add "</center></td>"
end
t.add """
<td><center><span id="add_{{{id}}}" onclick="add_part(this)" style="color:green;" class="action"><button class="btn btn-xs btn-success" type="button">Done</button></span></center></td>"""
t.add "</tr>"
+ # Compute score for each answer
+ var scores = new HashMap[Int, Int]
+ var maxsc = 0
+ for i in answers(db) do
+ scores[i.id] = i.score(db)
+ if scores[i.id] > maxsc then maxsc = scores[i.id]
+ end
+ t.add """
+<tr id="total">
+ <th>Total</th>
+ """
+ for i in answers(db) do
+ t.add """<th id="total{{{i.id}}}"><center>{{{i.count(db)}}}"""
+ if scores.has_key(i.id) and scores[i.id] >= maxsc then
+ t.add """<br/><span style="color:blue">★</span>"""
+ end
+ t.add "</center></th>"
+ end
+ t.add "</th>"
+ t.add """
+ <th></th>
+</tr>"""
t.add "</table>"
t.add "</div>"
return t
<input name="meetup_place" id="meetup_place" type="text" class="form-control" placeholder="Place of the event" value="{{{if meet != null then meet.place else ""}}}">
</div>
</div>
+ <div class = "form-group">
+ <label for="meetup=maybe" class="col-sm-4 control-label">Add a Maybe option?</label>
+ <div class="col-sm-8">
+ <input name="meetup_mode" id="meetup_mode" type="checkbox" class="form-control">
+ </div>
+ </div>
<h2>Opportunities</h2>
<div id="answers">
"""
var hj = new People("Jack", "Handsome")
-var m = new Meetup("Awaken the warrior", "2024/05/28", "Vault of the Warrior")
+var m = new Meetup("Awaken the warrior", "2024/05/28", "Vault of the Warrior", 0)
assert m.commit(db)
var vh = new People("Hunter", "Vault")
h.meetup = m
h.commit(db)
-hj.answer(y) = true
-hj.answer(n) = false
-hj.answer(h) = false
+hj.answer(y) = 1
+hj.answer(n) = 0
+hj.answer(h) = 0
-vh.answer(y) = true
-vh.answer(n) = false
-vh.answer(h) = false
+vh.answer(y) = 1
+vh.answer(n) = 0
+vh.answer(h) = 0
-ll.answer(y) = true
-ll.answer(n) = false
-ll.answer(h) = true
+ll.answer(y) = 1
+ll.answer(n) = 0
+ll.answer(h) = 1
hj.commit db
vh.commit db
# most of JNI functions. You can use it to further customize the behavior
# of your code.
module java is
- c_compiler_option("-I $(JAVA_HOME)/include/")
+ c_compiler_option "-I $(JAVA_HOME)/include/ -I $(JAVA_HOME)/include/linux/"
c_linker_option("-L $(JNI_LIB_PATH) -ljvm")
new_annotation extra_java_files
end
# Tell the C compiler where to find jni.h and how to link with libjvm
private fun insert_compiler_options
do
- c_compiler_options = "{c_compiler_options} -I $(JAVA_HOME)/include/"
+ c_compiler_options = "{c_compiler_options} -I $(JAVA_HOME)/include/ -I $(JAVA_HOME)/include/linux/"
c_linker_options = "{c_linker_options} -L $(JNI_LIB_PATH) -ljvm"
end
'B'.output
'1'.output
' '.output
- inita
+ super
'B'.output
'2'.output
' '.output
'C'.output
'1'.output
' '.output
- inita
+ super
'C'.output
'2'.output
' '.output
super C
init do
'D'.output
- '0'.output
- ' '.output
-#alt1# inita
-#alt3# inita
-#alt5# inita
-#alt7# inita
-#alt9# inita
-#alt11# inita
-#alt13# inita
-#alt15# inita
- 'D'.output
'1'.output
' '.output
-#alt2# initb
-#alt3# initb
-#alt6# initb
-#alt7# initb
-#alt10# initb
-#alt11# initb
-#alt14# initb
-#alt15# initb
+ super
'D'.output
'2'.output
' '.output
-#alt4# initc
-#alt5# initc
-#alt6# initc
-#alt7# initc
-#alt12# initc
-#alt13# initc
-#alt14# initc
-#alt15# initc
- 'D'.output
- '3'.output
- ' '.output
-#alt8# inite
-#alt9# inite
-#alt10# inite
-#alt11# inite
-#alt12# inite
-#alt13# inite
-#alt14# inite
-#alt15# inite
- 'D'.output
- '4'.output
- ' '.output
end
init inite do
'C'.output
'1'.output
' '.output
- inita
+ super
'C'.output
'2'.output
' '.output
bcm2835
-gtk3_6
-gtk3_8
-posix_ext
-physical_interface_for_mpd_on_rpi
blink
input
-android_app
-android_assets
-opengles1
-init_inherit
-init_linext
# See the License for the specific language governing permissions and
# limitations under the License.
-import end
-class Object
-end
+import kernel
class A
- fun toto do end
+ fun toto do 1.output
end
class B
super A
- redef fun toto do end
+ redef fun toto do 2.output
end
class C
super A
- redef fun toto do end
+ redef fun toto do 3.output
end
class D
super B
super C
end
+
+(new A).toto
+(new B).toto
+(new C).toto
+#alt1#(new D).toto
-init_inherit
-init_linext
-init_inherit
-init_linext
nitg
+nitdoc
-init_inherit
-init_linext
-init_inherit
-init_linext
-android
-init_inherit
-init_linext
test_mem
shoot_logic
bench_
nitg_args8
test_markdown_args1
pep8analysis
-nitcc_parser_gen
emscripten
nitserial_args
nitunit_args
-init_inherit
-init_linext
test_mem
shoot_logic
bench_
C{B{A}}cba
Ama
A2ma
-B{A}nbma
-O{C{B{A}}}onmcba
+B{A}nmba
+O{C{B{A}}}oncmba
Aba
Aca
Amca
-Anbmca
+Anmcba
B{A}ba
Aca
Amca
-B{A}nbmca
+B{A}nmcba
Aba
C{A}ca
C{A}mca
-C{A}nbmca
+C{A}nmcba
-alt/base_init_inherit2_alt3.nit:75,7: Error: Explicit constructor required in N since multiple inheritance of constructor is forbiden. Conflicting classes are B, C. Costructors are base_init_inherit2_alt3::B::cb, base_init_inherit2_alt3::A::ca, base_init_inherit2_alt3::C::cc.
+Aa
Ama
B{A}ba
Ana
-B{A}omba
-B{A}pbna
-B{A}qmbna
+B{A}obma
+B{A}pnba
+B{A}qnbma
Ama
B{A}ba
Ana
-B{A}omba
-B{A}pbna
-B{A}qombna
+B{A}obma
+B{A}pnba
+B{A}qonbma
Ama
B{A}ba
Ana
-B{A}omba
-B{A}pbna
-B{A}qmpbna
+B{A}obma
+B{A}pnba
+B{A}qpnbma
Ama
B{A}ba
Ana
-B{A}omba
-B{A}pbna
-B{A}qompbna
+B{A}obma
+B{A}pnba
+B{A}qponbma
Bba
-Bomba
-Bpbna
-Bqmbna
+Bobma
+Bpnba
+Bqnbma
Bba
-Bomba
-Bpbna
-Bqombna
+Bobma
+Bpnba
+Bqonbma
Bba
-Bomba
-Bpbna
-Bqmpbna
+Bobma
+Bpnba
+Bqpnbma
Bba
-Bomba
-Bpbna
-Bqompbna
+Bobma
+Bpnba
+Bqponbma
B2{A1}ba
C3{B2{A1}}cba
A1ma
-B2{A1}nbma
-O4{C3{B2{A1}}}onmcba
+B2{A1}nmba
+O4{C3{B2{A1}}}oncmba
-alt/base_init_inherit6_alt1.nit:32,10--14: Error: init is not a constructor in B.
+1
+2
+1
+3
+1
-alt/base_init_inherit6_alt2.nit:33,10--18: Error: foo is not a constructor in B.
+1
+2
+1
+3
+2
-alt/base_init_inherit_alt1.nit:95,2--9: Error: ca is not a constructor in B.
-alt/base_init_inherit_alt1.nit:96,2--10: Error: ca2 is not a constructor in B.
-alt/base_init_inherit_alt1.nit:98,2--9: Error: ca is not a constructor in C.
-alt/base_init_inherit_alt1.nit:99,2--10: Error: ca2 is not a constructor in C.
-alt/base_init_inherit_alt1.nit:100,2--9: Error: cb is not a constructor in C.
-alt/base_init_inherit_alt1.nit:104,2--9: Error: ca is not a constructor in N.
-alt/base_init_inherit_alt1.nit:105,2--10: Error: ca2 is not a constructor in N.
-alt/base_init_inherit_alt1.nit:107,2--9: Error: ca is not a constructor in O.
-alt/base_init_inherit_alt1.nit:108,2--10: Error: ca2 is not a constructor in O.
-alt/base_init_inherit_alt1.nit:109,2--9: Error: cb is not a constructor in O.
-alt/base_init_inherit_alt1.nit:110,2--9: Error: cc is not a constructor in O.
+Aa
+A2a
+B{A}ba
+Aba
+A2ba
+C{B{A}}cba
+Acba
+A2cba
+B{A}cba
+Ama
+A2ma
+B{A}nmba
+Anmba
+A2nmba
+O{C{B{A}}}oncmba
+Aoncmba
+A2oncmba
+B{A}oncmba
+C{B{A}}oncmba
-B1 A B2 C1 C2 D0 D1 D2 D3 D4
+D1 C1 B1 A B2 C2 D2
B1 A B2
A B3
A B4y
-C1 A C2
+C1 C2
A2z C3z
-D1 B1 A B2 C1 C2 D2 D3
+D1 B1 A B2 D2 D3
-alt/base_init_linext2_alt1.nit:100,1--5: Error: No contructor named initd in superclasses.
+alt/base_init_linext2_alt1.nit:100,1--5: Error: No super method to call for initd.
-alt/base_init_linext2_alt2.nit:99,2--5: Error: there is no available compatible constructor in B. Discarded candidates are base_init_linext2_alt2::B::initb, base_init_linext2_alt2::B::init_par, base_init_linext2_alt2::B::init_par2(c: Char).
+A
+A2x
+B1 A B2
+A B3
+A B4y
+C1 C2
+A2z C3z
+C1 C2 D1 D2 D3
B1 A B2
A B3
A B4y
-C1 A C2
+C1 C2
A2z C3z
D1 B1 A B2 D2 C1 C2 D3
-alt/base_init_linext2_alt4.nit:99,2--5: Error: there is no available compatible constructor in B. Discarded candidates are base_init_linext2_alt4::B::initb, base_init_linext2_alt4::B::init_par, base_init_linext2_alt4::B::init_par2(c: Char).
+A
+A2x
+B1 A B2
+A B3
+A B4y
+C1 C2
+A2z C3z
+D1 C1 C2 B1 A B2 D2 D3
-alt/base_init_linext2_alt5.nit:109,1--5: Error: Only one super constructor invocation of class B is allowed.
+A
+A2x
+B1 A B2
+A B3
+A B4y
+C1 C2
+A2z C3z
+D1 B1 A B2 D2 B1 A B2 D3
A
B1 A B2
C1 A C2
-B1 A B2 C1 C2 D0 D1 D2 D3 D4
-E1 A E2 B1 B2 E3 C1 C2 E4
+D1 C1 B1 A B2 C2 D2
+E1 D1 C1 B1 A B2 C2 D2 E2 D1 C1 B1 A B2 C2 D2 E3 D1 C1 B1 A B2 C2 D2 E4
+++ /dev/null
-D0 A B1 B2 C1 C2 D1 D2 D3 D4
+++ /dev/null
-D0 D1 B1 A B2 D2 D3 E1 E2 E3 C1 C2 E4 D4
+++ /dev/null
-D0 A D1 B1 B2 D2 D3 E1 E2 E3 C1 C2 E4 D4
+++ /dev/null
-D0 D1 D2 C1 A C2 D3 E1 E2 B1 B2 E3 E4 D4
+++ /dev/null
-D0 A D1 D2 C1 C2 D3 E1 E2 B1 B2 E3 E4 D4
+++ /dev/null
-D0 D1 B1 A B2 D2 C1 C2 D3 E1 E2 E3 E4 D4
+++ /dev/null
-D0 A D1 B1 B2 D2 C1 C2 D3 E1 E2 E3 E4 D4
+++ /dev/null
-D0 D1 B1 A B2 C1 C2 D2 D3 D4
+++ /dev/null
-D0 A D1 B1 B2 C1 C2 D2 D3 D4
+++ /dev/null
-B1 A B2 D0 D1 D2 C1 C2 D3 D4
+++ /dev/null
-D0 A B1 B2 D1 D2 C1 C2 D3 D4
+++ /dev/null
-D0 D1 B1 A B2 D2 C1 C2 D3 D4
+++ /dev/null
-D0 A D1 B1 B2 D2 C1 C2 D3 D4
+++ /dev/null
-D0 D1 D2 D3 E1 A E2 B1 B2 E3 C1 C2 E4 D4
+++ /dev/null
-D0 A D1 D2 D3 E1 E2 B1 B2 E3 C1 C2 E4 D4
A
b1 B1 A B2 b2
c1 C1 A C2 c2
-d1 b1 B1 A B2 b2 c1 C1 C2 c2 D0 D1 D2 D3 D4 d2
+d1 D1 c1 C1 b1 B1 A B2 b2 C2 c2 D2 d2
-Property inheritance conflict in class D for `toto': conflicting properties are defined in B, C
+1
+2
+3
--- /dev/null
+alt/error_prop_loc_alt1.nit:38,1--12: Warning: conflicting property definitions for property toto in D: error_prop_loc_alt1#B#toto error_prop_loc_alt1#C#toto
+1
+2
+3
+3
-alt/error_redef_1alt4_alt5.nit:30,12--13: Redef error: The procedure B::f1 redefines the function A::f1.
-alt/error_redef_1alt4_alt9.nit:34,15: Syntax error: untyped parameter.
+++ /dev/null
-1
-1
-5
-5
-1
-2
-5
-2
-1
-1
-3
-7
-1
-2
-3
-4
+++ /dev/null
-base_for_nullable.nit:21,10--13: Type error: 'for' on a nullable expression.
+++ /dev/null
-alt/base_for_nullable_alt1.nit:21,10--13: Type error: 'for' on a nullable expression.
+++ /dev/null
-alt/base_for_nullable_alt2.nit:21,10--13: Type error: 'for' on a nullable expression.
+++ /dev/null
-0
-0
-1
-2
-10
-20
-30
+++ /dev/null
-1
-0
-1
-2
-10
-20
-30
+++ /dev/null
-0
-0
-0
-1
-2
-10
-20
-30
+++ /dev/null
-10
-0
-1
-2
-10
-20
-30
+++ /dev/null
-10
-20
-0
-1
-2
-10
-20
-30
+++ /dev/null
-1
-1
-1
-aa
+++ /dev/null
-1
-1
-1
-1
-a
+++ /dev/null
-true
-true
-true
-false
-true
+++ /dev/null
-1
-2
-3
-0
-
-1
-100
-2
-0
-
-1
-10
-20
-100
-2
-10
+++ /dev/null
-0
-0
-1
-2
-10
-20
-30
+++ /dev/null
-1
-0
-1
-2
-10
-20
-30
+++ /dev/null
-0
-0
-0
-1
-2
-10
-20
-30
+++ /dev/null
-10
-0
-1
-2
-10
-20
-30
+++ /dev/null
-10
-20
-0
-1
-2
-10
-20
-30
+++ /dev/null
-1
-1
-1
-aa
+++ /dev/null
-1
-1
-1
-1
-a
+++ /dev/null
-true
-true
-true
-false
-true
+++ /dev/null
-1
-2
-3
-0
-
-1
-100
-2
-0
-
-1
-10
-20
-100
-2
-10
+++ /dev/null
-0
-0
-1
-2
-10
-20
-30
+++ /dev/null
-1
-0
-1
-2
-10
-20
-30
+++ /dev/null
-0
-0
-0
-1
-2
-10
-20
-30
+++ /dev/null
-10
-0
-1
-2
-10
-20
-30
+++ /dev/null
-10
-20
-0
-1
-2
-10
-20
-30
+++ /dev/null
-1
-1
-1
-aa
+++ /dev/null
-1
-1
-1
-1
-a
+++ /dev/null
-true
-true
-true
-false
-true
+++ /dev/null
-1
-2
-3
-0
-
-1
-100
-2
-0
-
-1
-10
-20
-100
-2
-10
-Property inheritance conflict in class B for `i': conflicting properties are defined in B, A
+1
+1
+5
+5
+1
+2
+5
+2
+1
+1
+3
+7
+1
+2
+3
+4
return new ArrayList();
`}
- fun add(o: Int) in "Java" `{ recv.add(o); `}
+ fun add(o: JavaString) in "Java" `{ recv.add(o); `}
redef fun output in "Java" `{
for (Object i: recv) {
- System.out.println((long)i);
+ System.out.println((String)i);
}
`}
end
var ll = new JavaArrayList
-ll.add(1)
-ll.add(2)
-ll.add(1)
-ll.add(3)
-ll.add(20)
-ll.add(10)
+ll.add "1".to_java_string
+ll.add "2".to_java_string
+ll.add "1".to_java_string
+ll.add "3".to_java_string
+ll.add "20".to_java_string
+ll.add "10".to_java_string
ll.output
ll.sort
ll.output
# Get the first Java lib available
shopt -s nullglob
-paths=`echo /usr/lib/jvm/*/`
-paths=($paths)
-JAVA_HOME=${paths[0]}
+JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac))))
paths=`echo $JAVA_HOME/jre/lib/*/{client,server}/`
paths=($paths)
JNI_LIB_PATH=${paths[0]}
+echo $JAVA_HOME
+echo $JNI_LIB_PATH
shopt -u nullglob
outdir="out"
engine=nitg-s;
enginebinname=nitg;
OPT="--separate $OPT --compile-dir $compdir"
+ savdirs="sav/nitg-common/"
;;
nitg-s)
enginebinname=nitg;
OPT="--separate $OPT --compile-dir $compdir"
+ savdirs="sav/nitg-common/"
;;
nitg-e)
enginebinname=nitg;
OPT="--erasure $OPT --compile-dir $compdir"
+ savdirs="sav/nitg-common/"
;;
nitg-sg)
enginebinname=nitg;
OPT="--semi-global $OPT --compile-dir $compdir"
+ savdirs="sav/nitg-common/"
;;
nitg-g)
enginebinname=nitg;
OPT="--global $OPT --compile-dir $compdir"
+ savdirs="sav/nitg-common/"
;;
nit)
engine=niti