Changeset 2201
- Timestamp:
- 07/08/08 14:24:07 (5 months ago)
- Files:
-
- trunk/ProjectFortress/src/com/sun/fortress/compiler/StaticJUTest.java (modified) (1 diff)
- trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/ConstraintFormula.java (modified) (5 diffs)
- trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeAnalyzer.java (modified) (1 diff)
- trunk/ProjectFortress/static_tests/DXXEqualityTesting.fss (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ProjectFortress/src/com/sun/fortress/compiler/StaticJUTest.java
r2199 r2201 42 42 "XXXMultipleRefErrors.fss", */ 43 43 // This test the accumulator which is not desugared yet 44 "Sum.fss", 45 "DXXGeneratorTuple.fss" 44 "Sum.fss" 46 45 //These are broken until the constraint solver is fixed 47 46 //"TupleAssignment.fss", trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/ConstraintFormula.java
r2200 r2201 84 84 import edu.rice.cs.plt.iter.IterUtil; 85 85 import edu.rice.cs.plt.lambda.Lambda; 86 import edu.rice.cs.plt.lambda.Runnable1; 86 87 import edu.rice.cs.plt.tuple.Option; 87 88 … … 145 146 /** 146 147 * This is a prototype class in an attempt to more closely implement the algorithm 147 * described in 148 * described in the spec 149 * 150 * We maintain an invariant that if (i1,i2) is in uppers (12,i1) is in lowers. 148 151 */ 149 152 public static class SimpleFormula extends ConstraintFormula { … … 357 360 // Returns a solved constraint formula, solved by doing the steps in 20.2 of spec1 beta 358 361 private ConstraintFormula solve() { 362 363 Set<_InferenceVarType> ivars = CollectUtil.union(ivarLowerBounds.keySet(), ivarUpperBounds.keySet()); 364 359 365 // 1.) for every cycle of constraints of naked prime static variables... 360 Set<_InferenceVarType> ivars = CollectUtil.union(ivarLowerBounds.keySet(), ivarUpperBounds.keySet());361 366 for( _InferenceVarType ivar : ivars ) { 362 367 Option<ConsList<_InferenceVarType>> cycle = … … 371 376 372 377 373 // 3.) If some primed static variable ... 374 Map<_InferenceVarType,Type> lubs = solveHelper(ivars, ivarUpperBounds, 378 //Preprocess: make sure every inference variable is bounded 379 380 final Set<_InferenceVarType> temp = new HashSet<_InferenceVarType>(); 381 temp.addAll(ivars); 382 final NodeDepthFirstVisitor_void v=new NodeDepthFirstVisitor_void(){ 383 @Override 384 public void for_InferenceVarType(_InferenceVarType that) { 385 temp.add(that); 386 } 387 }; 388 Runnable1<Type> accepter=new Runnable1<Type>(){ 389 public void run(Type arg0) { 390 arg0.accept(v); 391 } 392 }; 393 394 for(_InferenceVarType ivar: ivars){ 395 if(ivarUpperBounds.containsKey(ivar)){ 396 Set<Type> potentials = ivarUpperBounds.get(ivar); 397 IterUtil.run(potentials, accepter); 398 } 399 if(ivarLowerBounds.containsKey(ivar)){ 400 Set<Type> potentials = ivarLowerBounds.get(ivar); 401 IterUtil.run(potentials, accepter); 402 } 403 } 404 MultiMap<_InferenceVarType,Type> newuppers = new MultiMap<_InferenceVarType,Type>(ivarUpperBounds); 405 MultiMap<_InferenceVarType,Type> newlowers = new MultiMap<_InferenceVarType,Type>(ivarLowerBounds); 406 for(_InferenceVarType ivar: CollectUtil.complement(temp,ivarUpperBounds.keySet())){ 407 newuppers.putItem(ivar,Types.ANY); 408 } 409 for(_InferenceVarType ivar: CollectUtil.complement(temp,ivarLowerBounds.keySet())){ 410 newlowers.putItem(ivar,Types.BOTTOM); 411 } 412 413 ivars=temp; 414 415 // 2-3 416 Map<_InferenceVarType,Type> lubs = solveHelper(ivars, newuppers, 375 417 new Lambda<Set<Type>,Type>(){ 376 418 public Type value(Set<Type> arg0) { … … 378 420 }}); 379 421 380 // 4 .) for every naked static prime variable ...422 // 4-3' 381 423 // TODO: check to see if invariant is being violated by not using the new bounds from 382 424 // above here where we use ivarLowerbounds. 383 Map<_InferenceVarType,Type> glbs = solveHelper(ivars, ivarLowerBounds,425 Map<_InferenceVarType,Type> glbs = solveHelper(ivars, newlowers, 384 426 new Lambda<Set<Type>,Type>(){ 385 427 public Type value(Set<Type> arg0) { trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeAnalyzer.java
r2200 r2201 416 416 if (cached.isSome()) { 417 417 result = cached.unwrap(); 418 debug.log("found in cache"); 419 } 420 else 421 if (history.expansions() > MAX_SUBTYPE_EXPANSIONS) { 418 debug.log("found in cache"); 419 } 420 else if (history.expansions() > MAX_SUBTYPE_EXPANSIONS) { 422 421 result = FALSE; 423 422 debug.log("reached max subtype expansions"); trunk/ProjectFortress/static_tests/DXXEqualityTesting.fss
r2163 r2201 26 26 end 27 27 28 (* blah *) 29 28 30 run(args:String...):() = () 29 31
