Changeset 3834
- Timestamp:
- 06/10/09 18:11:17 (6 months ago)
- Location:
- trunk
- Files:
-
- 6 added
- 3 removed
- 2 modified
-
Library/CompilerLibrary.fsi (modified) (1 diff)
-
ProjectFortress/compiler_tests/Compiled0.w.fss (added)
-
ProjectFortress/compiler_tests/Compiled0.x.fss (added)
-
ProjectFortress/compiler_tests/Compiled0.y.fss (added)
-
ProjectFortress/compiler_tests/XXX0w.test (added)
-
ProjectFortress/compiler_tests/XXX0x.test (added)
-
ProjectFortress/compiler_tests/XXX0y.test (added)
-
ProjectFortress/not_working_static_tests/DXXCantExtendObject.fss (deleted)
-
ProjectFortress/not_working_static_tests/DXXCantExtendObject2.fss (deleted)
-
ProjectFortress/not_working_static_tests/DXXCantExtendObject3.fss (deleted)
-
ProjectFortress/src/com/sun/fortress/scala_src/typechecker/STypeChecker.scala (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Library/CompilerLibrary.fsi
r3310 r3834 18 18 api CompilerLibrary 19 19 20 ignore(_:Any):() 21 20 22 end -
trunk/ProjectFortress/src/com/sun/fortress/scala_src/typechecker/STypeChecker.scala
r3833 r3834 304 304 receiverType: Type): 305 305 Set[Method] = { 306 306 307 307 val traitTypes = traitTypesCallable(receiverType) 308 308 val ttAsWheres = traitTypes.map(NodeFactory.makeTraitTypeWhere) … … 430 430 expectedType: Option[Type]): 431 431 Option[(ArrowType, List[StaticArg])] = { 432 432 433 433 val arrows = conjuncts(fnType).toList.map(_.asInstanceOf[ArrowType]) 434 434 staticallyMostApplicableArrow(arrows, argType, expectedType) 435 435 } 436 436 437 437 /** 438 438 * Return the statically most applicable arrow type along with the static args … … 445 445 expectedType: Option[Type]): 446 446 Option[(ArrowType, List[StaticArg])] = { 447 447 448 448 // Filter applicable arrows and their instantiated args. 449 449 val arrowsAndInstantiations = … … 705 705 extendsC.foreach( (t:TraitTypeWhere) => 706 706 assertTrait(t.getBaseType, 707 "Objects can only extend traits.", o) )707 "Objects can only extend traits.", t.getBaseType) ) 708 708 val checkerWSparams = this.extend(sparams, params, where) 709 709 var method_checker = checkerWSparams … … 927 927 extendsC.foreach( (t:TraitTypeWhere) => 928 928 assertTrait(t.getBaseType, 929 "Objects can only extend traits.", o) )929 "Objects can only extend traits.", t.getBaseType) ) 930 930 var method_checker = this 931 931 var field_checker = this … … 943 943 val oi = IndexBuilder.buildObjectExprIndex(o) 944 944 val methods = new UnionRelation(inheritedMethods(extendsC), 945 oi.asInstanceOf[ObjectTraitIndex].dottedMethods.asInstanceOf )945 oi.asInstanceOf[ObjectTraitIndex].dottedMethods.asInstanceOf[Relation[IdOrOpOrAnonymousName, Method]]) 946 946 method_checker = method_checker.extendWithMethods(methods) 947 947 method_checker = method_checker.extendWithFunctions(oi.asInstanceOf[ObjectTraitIndex].functionalMethods) … … 1308 1308 } 1309 1309 1310 case SSubscriptExpr(SExprInfo(span, paren, _), obj, subs, op, sargs) => { 1310 case SSubscriptExpr(SExprInfo(span, paren, _), obj, subs, op, sargs) => { 1311 1311 val checkedObj = checkExpr(obj) 1312 1312 val checkedSubs = subs.map(checkExpr) 1313 1313 val objType = getType(checkedObj).getOrElse(return expr) 1314 1314 1315 1315 // Convert sub types into a single type or tuple of types. 1316 1316 if (!haveTypes(checkedSubs)) return expr … … 1320 1320 NodeFactory.makeTupleType(NodeUtil.getSpan(expr), toJavaList(t)) 1321 1321 } 1322 1322 1323 1323 // Get the methods and arrows from the op. 1324 1324 val methods = findMethodsInTraitHierarchy(op.get, objType) … … 1328 1328 flatMap(m => staticInstantiation(sargs, getArrowFromMethod(m))). 1329 1329 map(_.asInstanceOf[ArrowType]) 1330 1330 1331 1331 staticallyMostApplicableArrow(arrows.toList, subsType, None) match { 1332 1332 case Some((arrow, sargs)) => … … 1336 1336 op, 1337 1337 sargs) 1338 case one => 1338 case one => 1339 1339 // TODO: Better error message. 1340 1340 signal(expr, "Receiver type %s does not have applicable overloading of %s for argument type %s.". … … 1343 1343 } 1344 1344 } 1345 1345 1346 1346 case SStringLiteralExpr(SExprInfo(span,parenthesized,_), text) => 1347 1347 SStringLiteralExpr(SExprInfo(span,parenthesized,Some(Types.STRING)), text) … … 1436 1436 val checkedArgs = args.map(checkExpr) 1437 1437 if (!haveTypes(checkedArgs)) return expr 1438 1438 1439 1439 def checkAsInfix() = checkExpr(checkedArgs.reduceLeft( 1440 1440 (e1, e2) => SOpExpr(info, infixOp, List(e1, e2)))) 1441 1441 1442 // Attempt to check the multifix. 1442 // Attempt to check the multifix. 1443 1443 val checkedMultifixOp = 1444 1444 new TryChecker(current, traits, env, analyzer). 1445 1445 tryCheckExpr(multifixOp). 1446 1446 getOrElse(return checkAsInfix()) 1447 1447 1448 1448 val opType = getType(checkedMultifixOp).getOrElse(return expr) 1449 1449 val argType = … … 1602 1602 // "\n" + expr.toStringVerbose()) 1603 1603 } 1604 1604 1605 1605 /** 1606 1606 * A type checker that doesn't report its errors. Use the tryCheck() and … … 1623 1623 throw errors.errors.last 1624 1624 } 1625 1625 1626 1626 /** 1627 1627 * Adds to error log and throws the exception it made. 1628 1628 */ 1629 1629 override protected def signal(hasAt:HasAt, msg:String) = signal(msg, hasAt) 1630 1630 1631 1631 /** 1632 1632 * Check the given node; return it if successful, None otherwise. … … 1641 1641 } 1642 1642 } 1643 1643 1644 1644 /** 1645 1645 * Check the given expression; return it if successful, None otherwise.

