Skip to content

Commit

Permalink
The "normal" tcks now run
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffclick committed Nov 5, 2024
1 parent 22427d9 commit 22a32c5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions javatools_backend/src/main/java/org/xvm/xec/XTC.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public static class IllegalState extends Exception {
public static class IllegalArgument extends Exception {
public IllegalArgument(String s) { super(s); }
public static IllegalArgument construct(String s, String cause) { return new IllegalArgument(s); }
public static IllegalArgument construct(String s) { return new IllegalArgument(s); }
}

// XTC ReadOnlyException mapped to Java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public Arylong( long len, LongUnaryOperator fcn ) {
}
public static Arylong construct(Mutability mut, Arylong as) { return new Arylong(mut,as); }
public static Arylong construct() { return new Arylong(); }
public static Arylong construct( long len, LongUnaryOperator fcn ) { return new Arylong(len,fcn); }
public static Arylong construct(long len, LongUnaryOperator fcn ) { return new Arylong(len,fcn); }
public static Arylong construct(long len, long fill) { return new Arylong((int)len, i->fill ); }
public static Arylong construct(long len) { return new Arylong((int)len); }


Expand Down
21 changes: 17 additions & 4 deletions javatools_backend/src/main/java/org/xvm/xtc/ast/NewAST.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,30 @@ static NewAST make( ClzBuilder X, boolean isChild ) {
AST[] kids = X.kids_bias(isChild ? 1 : 0);
if( isChild )
kids[0] = outer;
return new NewAST(kids,(XClz)XType.xtype(type,true),X,type,meth);
return new NewAST(kids,(XClz)XType.xtype(type,true),X,type,meth,isChild);
}
// For internal constructors like auto-boxing
NewAST( AST[] kids, XClz xt ) {
this(kids,xt,null,null,null);
this(kids,xt,null,null,null,false);
}
NewAST( AST[] kids, XClz xt, ClzBuilder X, Const type, MethodPart meth ) {
NewAST( AST[] kids, XClz xt, ClzBuilder X, Const type, MethodPart meth, boolean isChild ) {
super(kids_plus_clz(kids,xt,X,type));
_type = xt;
_meth = meth;
if( meth!=null && kids!=null && meth._args.length != kids.length ) {

// Replace default args with their actual default values
if( _kids != null )
for( int i=1; i<_kids.length; i++ )
if( _kids[i] instanceof RegAST reg &&
reg._reg == -4/*Op.A_DEFAULT*/ ) { // Default reg
// Swap in the default from method defaults
TCon con = meth._args[i-1]._def;
_kids[i] = con==null
? new ConAST("0",meth.xfun().arg(i))
: new ConAST(null,con);
}

if( meth!=null && kids!=null && (meth._args==null?0:meth._args.length)+(isChild?1:0) != kids.length ) {
int len = kids.length;
assert len+1==meth._args.length; // more default args
_kids = Arrays.copyOf(_kids,meth._args.length);
Expand Down
5 changes: 3 additions & 2 deletions tck/src/main/x/tck.x
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module tck.xtclang.org {

/**
* This is temporary, for manual testing only; will be replaced by the xUint framework.
* This is temporary, for manual testing only; will be replaced by the xUnit framework.
*/
void run() {
new clazz.Basic().run();
Expand All @@ -15,9 +15,10 @@ module tck.xtclang.org {
new operations.Basic().run();
new tuples.Basic().run();
new tuples.MultiReturn().run();
//new services.Basic().run();
new time.Basic().run();
new constructors.Basic().run();
new union.Basic().run();
new services.Basic().run();

//new clazz.Medium().run();
//new array.Medium().run();
Expand Down

0 comments on commit 22a32c5

Please sign in to comment.