Changeset 2164
- Timestamp:
- 07/02/08 12:56:22 (2 months ago)
- Files:
-
- trunk/Library/FortressLibrary.fsi (modified) (7 diffs)
- trunk/Library/FortressLibrary.fss (modified) (15 diffs)
- trunk/ProjectFortress/LibraryBuiltin/FortressBuiltin.fsi (modified) (4 diffs)
- trunk/ProjectFortress/LibraryBuiltin/FortressBuiltin.fss (modified) (5 diffs)
- trunk/ProjectFortress/demos/lutx.fss (modified) (1 diff)
- trunk/ProjectFortress/src/com/sun/fortress/compiler/StaticJUTest.java (modified) (2 diffs)
- trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/types/FType.java (modified) (5 diffs)
- trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/values/OverloadedFunction.java (modified) (4 diffs)
- trunk/ProjectFortress/tests/BitTwiddle.fss (modified) (2 diffs)
- trunk/ProjectFortress/tests/asifTest.fss (modified) (1 diff)
- trunk/ProjectFortress/tests/initOrder.fss (modified) (1 diff)
- trunk/ProjectFortress/tests/overloadTest7.fss (modified) (1 diff)
- trunk/ProjectFortress/tests/overloadTest8.fss (modified) (1 diff)
- trunk/ProjectFortress/tests/tupleInfer.fss (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Library/FortressLibrary.fsi
r2150 r2164 265 265 opr juxtaposition(self, other:Self): Self 266 266 (** Exponentiation need only deal with natural exponents. **) 267 opr ^(self, other: Integral): Self267 opr ^(self, other:ZZ64): Self 268 268 end 269 269 … … 320 320 end 321 321 322 trait RR64 extends Number comprises { Float, Integral, FloatLiteral }322 trait RR64 extends Number comprises { Float, AnyIntegral, FloatLiteral } 323 323 (** returns true if the value is an IEEE NaN **) 324 324 getter isNaN(): Boolean … … 335 335 (** obtain the raw bits of the IEEE floating-point representation of this value. **) 336 336 getter rawBits():ZZ64 337 (** next higher IEEE float **) 338 getter nextUp():RR64 339 (** next lower IEEE float **) 340 getter nextDown():RR64 337 341 (** %MINNUM% and %MAXNUM% return a numeric result where possible (avoiding NaN). 338 342 Note that %MINNUM% and %MAX% form a lattice with NaN at the top, and … … 342 346 end 343 347 344 trait Integral extends { StandardTotalOrder[\Integral\], RR64 } 348 trait AnyIntegral extends { RR64 } end 349 350 trait Integral[\I extends Integral[\I\]\] extends { StandardTotalOrder[\I\], AnyIntegral } 345 351 comprises { ZZ64, IntLiteral } 346 opr =(self, b:Integral):Boolean 347 opr <(self, b:Integral):Boolean 348 349 opr -(self):ZZ64 350 opr +(self,b:Integral):ZZ64 351 opr -(self,b:Integral):ZZ64 352 opr DOT(self,b:Integral):ZZ64 353 opr TIMES(self,b:Integral):ZZ64 354 opr juxtaposition(self,b:Integral):ZZ64 355 opr DIV(self,b:Integral):ZZ64 356 opr REM(self,b:Integral):ZZ64 357 opr MOD(self,b:Integral):ZZ64 358 opr GCD(self,b:Integral):ZZ64 359 opr LCM(self,b:Integral):ZZ64 360 opr CHOOSE(self,b:Integral):ZZ64 361 opr BITAND(self,b:Integral):ZZ64 362 opr BITOR(self,b:Integral):ZZ64 363 opr BITXOR(self,b:Integral):ZZ64 364 opr LSHIFT(self,b:Integral):ZZ64 365 opr RSHIFT(self,b:Integral):ZZ64 366 opr BITNOT(self):ZZ64 367 opr ^(self, b:Integral):Number 352 getter zero(): I 353 getter one(): I 354 355 opr -(self):I 356 opr +(self,b:I):I 357 opr -(self,b:I):I 358 opr DOT(self,b:I):I 359 opr TIMES(self,b:I):I 360 opr juxtaposition(self,b:I):I 361 opr DIV(self,b:I):I 362 opr REM(self,b:I):I 363 opr MOD(self,b:I):I 364 opr GCD(self,b:I):I 365 opr LCM(self,b:I):I 366 opr CHOOSE(self,b:I):I 367 opr BITAND(self,b:I):I 368 opr BITOR(self,b:I):I 369 opr BITXOR(self,b:I):I 370 opr LSHIFT(self,b:ZZ64):I 371 opr RSHIFT(self,b:ZZ64):I 372 opr BITNOT(self):I 373 opr ^(self, b:ZZ64):RR64 374 end 375 376 trait ZZ64 extends { Integral[\ZZ64\] } comprises { Long, ZZ32 } 368 377 narrow(self):ZZ32 369 end370 371 trait ZZ64 extends Integral comprises { Long, ZZ32 }372 378 end 373 379 … … 451 457 the predicate p are retained. Natural order and cross product 452 458 properties are otherwise preserved. **) 453 filter(f: E -> Condition[\()\]): Generator[\E\] 459 filter(f: E -> Condition[\()\]): Generator[\E\] 454 460 455 461 (** Cross product of two generators. This is specifically … … 1631 1637 getter g(): Generator[\E\] 1632 1638 getter p(): E -> Condition[\()\] 1633 getter toString(): String 1639 getter toString(): String 1634 1640 generate[\R\](r:Reduction[\R\], m: E->R): R 1635 1641 reduce(r: Reduction[\E\]): E 1636 filter(p': E -> Condition[\()\]): FilterGenerator[\E\] 1642 filter(p': E -> Condition[\()\]): FilterGenerator[\E\] 1637 1643 seq(self) 1638 1644 end … … 1737 1743 1738 1744 (** The %#% and %:% operators serve as factories for parallel ranges. **) 1739 opr #[\I extends Integral\](lo:I, ex:I): Range[\I\]1745 opr #[\I extends AnyIntegral\](lo:I, ex:I): Range[\I\] 1740 1746 opr #(lo:IntLiteral, ex:IntLiteral): Range[\ZZ32\] 1741 opr #[\I extends Integral, J extendsIntegral\]1747 opr #[\I extends AnyIntegral, J extends AnyIntegral\] 1742 1748 (lo:(I,J), ex:(I,J)): Range[\(I,J)\] 1743 opr #[\I extends Integral, J extends Integral, K extendsIntegral\]1749 opr #[\I extends AnyIntegral, J extends AnyIntegral, K extends AnyIntegral\] 1744 1750 (lo:(I,J,K), ex:(I,J,K)): Range[\(I,J,K)\] 1745 opr :[\I extends Integral\](lo:I, hi:I): FullRange[\I\]1751 opr :[\I extends AnyIntegral\](lo:I, hi:I): FullRange[\I\] 1746 1752 opr :(lo:IntLiteral, ex:IntLiteral): FullRange[\ZZ32\] 1747 opr :[\I extends Integral, J extendsIntegral\]1753 opr :[\I extends AnyIntegral, J extends AnyIntegral\] 1748 1754 (lo:(I,J), hi:(I,J)): Range[\(I,J)\] 1749 opr :[\I extends Integral, J extends Integral, K extendsIntegral\]1755 opr :[\I extends AnyIntegral, J extends AnyIntegral, K extends AnyIntegral\] 1750 1756 (lo:(I,J,K), hi:(I,J,K)): Range[\(I,J,K)\] 1751 1757 trunk/Library/FortressLibrary.fss
r2163 r2164 318 318 opr juxtaposition(self, other:Self): Self = self TIMES other 319 319 (** Exponentiation need only deal with natural exponents. **) 320 opr ^(self, other: Integral): Self320 opr ^(self, other:ZZ64): Self 321 321 end 322 322 … … 397 397 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Pow") 398 398 (** Shouldn't need this extra declaration. **) 399 opr ^(self, b: Integral):RR64 =399 opr ^(self, b:ZZ64):RR64 = 400 400 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Pow") 401 401 sin(self):RR64 = … … 429 429 end 430 430 431 trait RR64 extends Number comprises { Float, Integral, FloatLiteral }431 trait RR64 extends Number comprises { Float, AnyIntegral, FloatLiteral } 432 432 (** returns true if the value is an IEEE NaN **) 433 433 getter isNaN(): Boolean = … … 480 480 end 481 481 482 trait Integral extends { StandardTotalOrder[\Integral\], RR64 } 482 trait AnyIntegral extends { RR64 } end 483 484 trait Integral[\I extends Integral[\I\]\] extends { StandardTotalOrder[\I\], AnyIntegral } 483 485 comprises { ZZ64, IntLiteral } 484 getter zero(): Number = widen(0) 485 getter one(): Number = widen(1) 486 487 opr =(self, b:Integral):Boolean = 488 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Eq") 489 opr =/=(self, b:Integral): Boolean = NOT (self=b) 490 491 opr <(self, b:Integral):Boolean = 492 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Less") 493 494 opr -(self):ZZ64 = 495 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Negate") 496 opr +(self,b:Integral):ZZ64 = 497 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Add") 498 opr -(self,b:Integral):ZZ64 = 499 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Sub") 500 opr DOT(self,b:Integral):ZZ64 = 501 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Mul") 502 opr TIMES(self,b:Integral):ZZ64 = 503 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Mul") 504 opr juxtaposition(self,b:Integral):ZZ64 = 505 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Mul") 506 opr DIV(self,b:Integral):ZZ64 = 507 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Div") 508 opr REM(self,b:Integral):ZZ64 = 509 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Rem") 510 opr MOD(self,b:Integral):ZZ64 = 511 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Mod") 512 opr GCD(self,b:Integral):ZZ64 = 513 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Gcd") 514 opr LCM(self,b:Integral):ZZ64 = 515 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Lcm") 516 opr CHOOSE(self,b:Integral):ZZ64 = 517 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Choose") 518 opr BITAND(self,b:Integral):ZZ64 = 519 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$BitAnd") 520 opr BITOR(self,b:Integral):ZZ64 = 521 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$BitOr") 522 opr BITXOR(self,b:Integral):ZZ64 = 523 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$BitXor") 524 opr LSHIFT(self,b:Integral):ZZ64 = 525 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$LShift") 526 opr RSHIFT(self,b:Integral):ZZ64 = 527 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$RShift") 528 opr BITNOT(self):ZZ64 = 529 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$BitNot") 530 opr ^(self, b:Integral):RR64 = 531 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Pow") 532 narrow(self):ZZ32 = 533 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$FromLong") 534 end 535 536 trait ZZ64 extends { StandardTotalOrder[\ZZ64\], Integral } comprises { Long, ZZ32 } 486 getter zero(): I 487 getter one(): I 488 489 opr -(self):I 490 opr +(self,b:I):I 491 opr -(self,b:I):I 492 opr DOT(self,b:I):I 493 opr TIMES(self,b:I):I 494 opr juxtaposition(self,b:I):I 495 opr DIV(self,b:I):I 496 opr REM(self,b:I):I 497 opr MOD(self,b:I):I 498 opr GCD(self,b:I):I 499 opr LCM(self,b:I):I 500 opr CHOOSE(self,b:I):I 501 opr BITAND(self,b:I):I 502 opr BITOR(self,b:I):I 503 opr BITXOR(self,b:I):I 504 opr LSHIFT(self,b:ZZ64):I 505 opr RSHIFT(self,b:ZZ64):I 506 opr BITNOT(self):I 507 opr ^(self, b:ZZ64):RR64 508 end 509 510 trait ZZ64 extends { Integral[\ZZ64\] } comprises { Long, ZZ32 } 511 getter zero(): ZZ64 = widen(0) 512 getter one(): ZZ64 = widen(1) 513 537 514 opr |x:ZZ64| : ZZ64 = if x>=0 then x else -x end 538 515 … … 541 518 opr <(self, b:ZZ64):Boolean = 542 519 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Less") 520 521 opr -(self):ZZ64 = 522 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Negate") 523 opr +(self,b:ZZ64):ZZ64 = 524 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Add") 525 opr -(self,b:ZZ64):ZZ64 = 526 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Sub") 527 opr DOT(self,b:ZZ64):ZZ64 = 528 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Mul") 529 opr TIMES(self,b:ZZ64):ZZ64 = 530 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Mul") 531 opr juxtaposition(self,b:ZZ64):ZZ64 = 532 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Mul") 533 opr DIV(self,b:ZZ64):ZZ64 = 534 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Div") 535 opr REM(self,b:ZZ64):ZZ64 = 536 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Rem") 537 opr MOD(self,b:ZZ64):ZZ64 = 538 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Mod") 539 opr GCD(self,b:ZZ64):ZZ64 = 540 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Gcd") 541 opr LCM(self,b:ZZ64):ZZ64 = 542 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Lcm") 543 opr CHOOSE(self,b:ZZ64):ZZ64 = 544 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Choose") 545 opr BITAND(self,b:ZZ64):ZZ64 = 546 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$BitAnd") 547 opr BITOR(self,b:ZZ64):ZZ64 = 548 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$BitOr") 549 opr BITXOR(self,b:ZZ64):ZZ64 = 550 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$BitXor") 551 opr LSHIFT(self,b:ZZ64):ZZ64 = 552 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$LShift") 553 opr RSHIFT(self,b:ZZ64):ZZ64 = 554 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$RShift") 555 opr BITNOT(self):ZZ64 = 556 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$BitNot") 557 opr ^(self, b:ZZ64):RR64 = 558 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$Pow") 559 narrow(self):ZZ32 = 560 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$FromLong") 543 561 end 544 562 … … 1709 1727 __Proxy[\ZZ32\] => vector[\T,s0\]() 1710 1728 __Proxy[\ZZ64\] => vector[\T,s0\]() 1711 __Proxy[\Integral\] => vector[\T,s0\]()1712 1729 __Proxy[\RR64\] => vector[\T,s0\]() 1713 1730 __Proxy[\Number\] => vector[\T,s0\]() … … 2006 2023 __Proxy[\ZZ32\] => matrix[\T,s0,s1\]() 2007 2024 __Proxy[\ZZ64\] => matrix[\T,s0,s1\]() 2008 __Proxy[\Integral\] => matrix[\T,s0,s1\]()2009 2025 __Proxy[\RR64\] => matrix[\T,s0,s1\]() 2010 2026 __Proxy[\Number\] => matrix[\T,s0,s1\]() … … 2745 2761 end 2746 2762 2747 opr PCMP(a: Integral, b:Integral): TotalComparison = a CMP b2763 opr PCMP(a:Number, b:Number): TotalComparison = a CMP b 2748 2764 2749 2765 (** Non-traditional subtraction of bounds, elementwise on tuples **) … … 2760 2776 end 2761 2777 2762 opr SUBTR[\T extends Integral\](a:T, b:T):T = 1+ a - b2778 opr SUBTR[\T extends MultiplicativeRing[\T\]\](a:T, b:T):T = a.one() + a - b 2763 2779 2764 2780 (** join upper and lower bounds comparisons (total or partial) to … … 2966 2982 generators. They generate |self| numbers, incrementing by 1, starting 2967 2983 with lower() (that's the canonical ordering). *) 2968 trait ScalarRange[\N extends Integral \]2984 trait ScalarRange[\N extends Integral[\N\]\] 2969 2985 extends { FullRange[\N\] } 2970 2986 comprises { ParRange[\N\], SeqRange[\N\] } … … 2987 3003 end 2988 3004 2989 value object ParRange[\N extends Integral \](lo:N, ex:N)3005 value object ParRange[\N extends Integral[\N\]\](lo:N, ex:N) 2990 3006 extends ScalarRange[\N\] 2991 3007 getter extent() = ex … … 3057 3073 end 3058 3074 end 3059 value object SeqRange[\N extends Integral \](lo:N, ex:N)3075 value object SeqRange[\N extends Integral[\N\]\](lo:N, ex:N) 3060 3076 extends { ScalarRange[\N\], SequentialGenerator[\N\] } 3061 3077 getter extent() = ex … … 3090 3106 end 3091 3107 3092 object Tuple2Range[\N extends Integral , M extends Integral\]3108 object Tuple2Range[\N extends Integral[\N\], M extends Integral[\M\]\] 3093 3109 (l1:N,l2:M,x1:N,x2:M) 3094 3110 extends { TupleRange[\(N,M)\], DelegatedIndexed[\(N,M),(N,M)\] } … … 3122 3138 end 3123 3139 3124 object Tuple3Range[\N1 extends Integral , N2 extends Integral, N3 extends Integral\]3140 object Tuple3Range[\N1 extends Integral[\N1\], N2 extends Integral[\N2\], N3 extends Integral[\N3\]\] 3125 3141 (l1:N1,l2:N2,l3:N3,x1:N1,x2:N2,x3:N3) 3126 3142 extends { TupleRange[\(N1,N2,N3)\], … … 3160 3176 3161 3177 (** The # and : operators serve as factories for parallel ranges. **) 3162 opr #[\I extends Integral\](lo:I, ex:I): ParRange[\I\] = ParRange[\I\](lo,ex) 3178 opr #[\I extends AnyIntegral\](lo:I, ex:I): ParRange[\I\] = ParRange[\I\](lo,ex) 3179 (* 3163 3180 opr #(lo:IntLiteral, ex:IntLiteral): ParRange[\ZZ32\] = ParRange[\ZZ32\](lo,ex) 3164 opr #[\I extends Integral, J extends Integral\] 3181 *) 3182 opr #[\I extends AnyIntegral, J extends AnyIntegral\] 3165 3183 (lo:(I,J), ex:(I,J)): Tuple2Range[\I,J\] = 3166 3184 do (l1,l2)=lo; (x1,x2)=ex; Tuple2Range[\I,J\](l1,l2,x1,x2) end 3167 opr #[\I extends Integral, J extends Integral, K extendsIntegral\]3185 opr #[\I extends AnyIntegral, J extends AnyIntegral, K extends AnyIntegral\] 3168 3186 (lo:(I,J,K), ex:(I,J,K)): Tuple3Range[\I,J,K\] = 3169 3187 do (l1,l2,l3)=lo; (x1,x2,x3)=ex; Tuple3Range[\I,J,K\](l1,l2,l3,x1,x2,x3) end 3170 3188 3171 opr :[\I extends Integral\](lo:I, hi:I): ParRange[\I\] =3189 opr :[\I extends AnyIntegral\](lo:I, hi:I): ParRange[\I\] = 3172 3190 ParRange[\I\](lo,hi-lo+1) 3191 (* 3173 3192 opr :(lo:IntLiteral, hi:IntLiteral): ParRange[\ZZ32\] = 3174 3193 ParRange[\ZZ32\](lo,hi-lo+1) 3175 opr :[\I extends Integral, J extends Integral\] 3194 *) 3195 opr :[\I extends AnyIntegral, J extends AnyIntegral\] 3176 3196 (lo:(I,J), hi:(I,J)): Tuple2Range[\I,J\] = 3177 3197 do (l1,l2)=lo; (h1,h2)=hi; Tuple2Range[\I,J\](l1,l2,h1-l1+1,h2-l2+1) end 3178 opr :[\I extends Integral, J extends Integral, K extendsIntegral\]3198 opr :[\I extends AnyIntegral, J extends AnyIntegral, K extends AnyIntegral\] 3179 3199 (lo:(I,J,K), hi:(I,J,K)): Tuple3Range[\I,J,K\] = do 3180 3200 (l1,l2,l3)=lo; (h1,h2,h3)=hi trunk/ProjectFortress/LibraryBuiltin/FortressBuiltin.fsi
r2159 r2164 25 25 26 26 value object ZZ32 extends ZZ64 27 getter zero(): Number 28 getter one(): Number 29 30 opr |self| : ZZ32 27 31 opr =(self, b:ZZ32):Boolean 28 32 opr <(self, b:ZZ32):Boolean … … 42 46 opr BITOR(self,b:ZZ32):ZZ32 43 47 opr BITXOR(self,b:ZZ32):ZZ32 44 opr LSHIFT(self,b: Integral):ZZ3245 opr RSHIFT(self,b: Integral):ZZ3248 opr LSHIFT(self,b:ZZ64):ZZ32 49 opr RSHIFT(self,b:ZZ64):ZZ32 46 50 opr BITNOT(self):ZZ32 47 opr ^(self, b: Integral):Number51 opr ^(self, b:ZZ64):RR64 48 52 widen(self):ZZ64 49 53 partitionL(self):ZZ32 … … 53 57 end 54 58 55 object IntLiteral extends Integral 59 object IntLiteral extends Integral[\IntLiteral\] 56 60 opr =(self, b: IntLiteral):Boolean 57 61 opr <(self, other:IntLiteral): Boolean … … 75 79 opr BITOR(self, b: IntLiteral): IntLiteral 76 80 opr BITXOR(self, b: IntLiteral): IntLiteral 77 opr LSHIFT(self, b: Integral): IntLiteral78 opr RSHIFT(self, b: Integral): IntLiteral81 opr LSHIFT(self, b:ZZ64): IntLiteral 82 opr RSHIFT(self, b:ZZ64): IntLiteral 79 83 opr BITNOT(self): IntLiteral 80 opr ^(self, b: Integral):Number84 opr ^(self, b:ZZ64):RR64 81 85 end 82 86 trunk/ProjectFortress/LibraryBuiltin/FortressBuiltin.fss
r2163 r2164 29 29 30 30 value object ZZ32 extends { StandardTotalOrder[\ZZ32\], ZZ64 } 31 getter zero(): Number= 032 getter one(): Number= 131 getter zero(): ZZ32 = 0 32 getter one(): ZZ32 = 1 33 33 34 34 opr |self| : ZZ32 = if self>=0 then self else -self end … … 66 66 opr BITXOR(self,b:ZZ32):ZZ32 = 67 67 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.ZZ32$BitXor") 68 opr LSHIFT(self,b: Integral):ZZ32 =68 opr LSHIFT(self,b:ZZ64):ZZ32 = 69 69 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.ZZ32$LShift") 70 opr RSHIFT(self,b: Integral):ZZ32 =70 opr RSHIFT(self,b:ZZ64):ZZ32 = 71 71 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.ZZ32$RShift") 72 72 opr BITNOT(self):ZZ32 = 73 73 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.ZZ32$BitNot") 74 opr ^(self, b: Integral):RR64 =74 opr ^(self, b:ZZ64):RR64 = 75 75 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.ZZ32$Pow") 76 76 widen(self):ZZ64 = … … 83 83 end 84 84 85 object IntLiteral extends Integral 85 object IntLiteral extends Integral[\IntLiteral\] 86 getter zero(): IntLiteral = 87 1934791870947204798109283471902037419 - 1934791870947204798109283471902037419 88 getter one(): IntLiteral = zero() + 1 86 89 opr |self| : ZZ32 = if self>=0 then self else -self end 87 90 opr =(self, b: IntLiteral):Boolean = … … 104 107 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Mul") 105 108 opr juxtaposition(self, b: IntLiteral): IntLiteral = 109 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Mul") 110 opr TIMES(self, b: IntLiteral): IntLiteral = 106 111 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Mul") 107 112 opr DIV(self, b: IntLiteral): IntLiteral = … … 123 128 opr BITXOR(self, b: IntLiteral): IntLiteral = 124 129 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$BitXor") 125 opr LSHIFT(self, b: Integral): IntLiteral =130 opr LSHIFT(self, b:ZZ64): IntLiteral = 126 131 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$LShift") 127 opr RSHIFT(self, b: Integral): IntLiteral =132 opr RSHIFT(self, b:ZZ64): IntLiteral = 128 133 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$RShift") 129 134 opr BITNOT(self): IntLiteral = 130 135 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$BitNot") 131 opr ^(self, b: Integral):RR64 =136 opr ^(self, b:ZZ64):RR64 = 132 137 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Pow") 133 138 end trunk/ProjectFortress/demos/lutx.fss
r1009 r2164 24 24 25 25 26 opr MAXMIN[\N extends Number, I extends Integral\](a:(N,I),b:(N,I)):(N,I) = do26 opr MAXMIN[\N extends Number, I extends AnyIntegral\](a:(N,I),b:(N,I)):(N,I) = do 27 27 (x1,n1) = a 28 28 (x2,n2) = b trunk/ProjectFortress/src/com/sun/fortress/compiler/StaticJUTest.java
r2163 r2164 27 27 28 28 public class StaticJUTest extends TestCaseWrapper { 29 29 30 30 private final static String STATIC_TESTS_DIR = ProjectProperties.BASEDIR + "static_tests/"; 31 31 private final static List<String> FAILING_DISAMBIGUATOR = Arrays.asList(); 32 32 private final static List<String> FAILING_TYPE_CHECKER = Arrays.asList( 33 33 /* "XXXMultipleRefErrors.fss", 34 "GenericFunctionCall.fss",34 "GenericFunctionCall.fss", 35 35 "CrossOverloaded.fss", 36 36 "SimpleObject.fss", … … 47 47 "MethodInvocationStaticInfer1.fss", 48 48 "MethodInvocationStaticInfer2.fss", 49 "While.fss" 49 "While.fss", 50 "PlusEq.fss" // Regression after library change: See ticket #143 50 51 ); 51 52 52 53 public static TestSuite suite() { 53 54 return new StaticTestSuite("StaticJUTest", 54 55 STATIC_TESTS_DIR, 55 56 FAILING_DISAMBIGUATOR, 56 FAILING_TYPE_CHECKER); 57 FAILING_TYPE_CHECKER); 57 58 } 58 59 } trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/types/FType.java
r1895 r2164 173 173 174 174 private void computeTransitiveExcludes() { 175 exclDump("Computing transitive excludes for ",this,":"); 175 176 for (FType t : getExtends()) { 176 177 for (FType x : t.getExcludes()) { 177 178 addExclude(x); 178 exclDump( " ",t," excludes ",x);179 exclDump(t," excludes ",x,"; "); 179 180 } 180 181 } … … 229 230 return true; 230 231 if (excludesOtherSimply(other)) { 231 exclDump("Ought to return true now.");232 232 return true; 233 233 } … … 282 282 } 283 283 // Next, check that a supertype of other isn't excluded by us. 284 exclDump("\nChecking for supertype exclusion of ",this,": "); 284 285 for (FType t1 : other.getTransitiveExtends()) { 285 286 if (excludes.contains(t1)) { … … 288 289 return true; 289 290 } 291 exclDump("Not ",t1,"; "); 292 } 293 // And vice versa. 294 exclDump("\nChecking for supertype exclusion of ",other,": "); 295 Set<FType> oexcl = other.getExcludes(); 296 for (FType t1 : this.getTransitiveExtends()) { 297 if (oexcl.contains(t1)) { 298 exclDumpln("Excludes supertype ", t1, "."); 299 addExclude(other); 300 return true; 301 } 302 exclDump("Not ",t1,"; "); 290 303 } 291 304 // We shouldn't need to check the other way 'round by reflexivity. … … 300 313 for (FType t1 : getTransitiveComprises()) { 301 314 for (FType t2 : other.getTransitiveComprises()) { 302 exclDump("Checking extends of comprised ",t1," and ",t2 );315 exclDump("Checking extends of comprised ",t1," and ",t2,"; "); 303 316 if (!t1.excludesOther(t2)) { 304 317 return false; trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/values/OverloadedFunction.java
r1895 r2164 74 74 75 75 static final boolean DUMP_EXCLUSION = false; 76 static int excl_skip = 100000 0;76 static int excl_skip = 100000; 77 77 78 78 public static void exclDump(Object... os) { … … 500 500 } 501 501 } 502 502 503 503 504 504 describeOverloadingFailure(o1, o2, within, pl1, … … 526 526 if (p1better < 0 && p2better < 0 && selfIndex < 0) 527 527 return false; 528 528 529 529 if (result1Subtype2Failure || result2Subtype1Failure) 530 530 return false; … … 582 582 error(o1, o2, within, explanation); 583 583 } 584 584 585 585 if (result1Subtype2Failure) { 586 586 String explanation = errorMsg("Overloading of ", o1, " and ", o2, trunk/ProjectFortress/tests/BitTwiddle.fss
r1665 r2164 19 19 export Executable 20 20 21 doit[\I extends Integral \](n:I,sz:ZZ64) = do21 doit[\I extends Integral[\I\]\](n:I,sz:ZZ64) = do 22 22 n_bar = BITNOT n 23 23 z : I = 0 … … 51 51 doit(n,32) 52 52 println("ZZ32 OK") 53 doit [\ZZ64\](n',64)53 doit(n',64) 54 54 println("ZZ64 OK") 55 55 end trunk/ProjectFortress/tests/asifTest.fss
r2155 r2164 107 107 (* Mixed generic and overloaded method, at supertype. *) 108 108 typecase z = (3 asif RR64) + 17 of 109 Integral => println("FAIL, got ZZ32" z)109 ZZ64 => println("FAIL, got ZZ64 " z) 110 110 RR64 => println("PASS, got RR64 " z) 111 111 else => println("Got unknown typed " z) trunk/ProjectFortress/tests/initOrder.fss
r54 r2164 24 24 25 25 (* Everything must extend this trait, or the bug will disappear. *) 26 trait S 26 trait S excludes { Number } 27 27 end 28 28 trunk/ProjectFortress/tests/overloadTest7.fss
r1074 r2164 23 23 derived automatically for any two object types. 24 24 25 Ought to work as of r1071 *)25 Ought to work as of r1071 26 26 27 trait notRR64 (* excludes {RR64} *) end 27 But now doesn't anymore, as RR64 is no longer closed due to absence 28 of where clauses preventing Integral closure. *) 29 30 trait notRR64 excludes {RR64} end 28 31 29 32 trait super extends {notRR64} end trunk/ProjectFortress/tests/overloadTest8.fss
r1074 r2164 23 23 derived automatically for any two object types. 24 24 25 Ought to work as of r1071 *)25 Ought to work as of r1071 26 26 27 trait notRR64 (* excludes {RR64} *) end 27 But now doesn't anymore, as RR64 is no longer closed due to absence 28 of where clauses preventing Integral closure. *) 29 30 trait notRR64 excludes {RR64} end 28 31 29 32 trait super extends {notRR64} end trunk/ProjectFortress/tests/tupleInfer.fss
r2 r2164 20 20 21 21 (* Tests that we can instantiate generics inside tuples *) 22 opr MAXMIN[\N extends Number, I extends Integral\](a:(N,I),b:(N,I)):(N,I) = a22 opr MAXMIN[\N extends Number, I extends AnyIntegral\](a:(N,I),b:(N,I)):(N,I) = a 23 23 24 24 run(args:String...):()=do
