1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
/**************************************************************************/
/* N I C E */
/* A high-level object-oriented research language */
/* (c) Daniel Bonniot 2001 */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/**************************************************************************/
package regtest.basic;
/**
Features used in regtest.multipkg
regtest.basic is first compiled, then regtest.multipkg loads
a compiled version of it.
This is useful to check how the compiler behaves with compiled
packages.
@version $Date: 2002/09/09 12:59:26 $
@author Daniel Bonniot (Daniel.Bonniot@inria.fr)
*/
// return zero, but uses a Literal to store it.
int getZero()
{
Ref<int> id = new Ref(value: 0);
id.value = 0;
return id.value;
}
// Check that the correct overloaded method is called from compiled packages
// This can trigger mangling bugs if they existed
int overload1(int) = 1;
int overload1(int, int) = 2;
int overload2(int, int) = 2;
int overload2(int) = 1;
// Create two functions that have the same name and bytecode type
byte clash(List<byte> l) = l[0];
boolean clash(List<boolean> l) = l[0];
class Multi
{
alike polymorphic1() = this;
alike polymorphic2();
polymorphic2() = this;
}
// Test functional types, the way they are parsed and dumped in the interface.
class Funs
{
int->int f1;
int->int->int f2;
int->int->int->int f3;
(int->int)->int f4;
(int->int)->int->int f5;
(int,int)->int f6;
int ?-> int f7;
(int,int)?->int f8;
int->int[] f9;
Array<int->int> f10;
}
|