Changeset 661214c
- Timestamp:
- Mar 7, 2018, 5:02:11 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- b2e8841
- Parents:
- 02c816fc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r02c816fc r661214c 1587 1587 assert( newMemberExpr ); 1588 1588 1589 Type *memberType = memberExpr->member->get_type(); 1589 // Must apply the generic substitution to the member type to handle cases where the member is a generic parameter substituted by a known concrete type, e.g. 1590 // forall(otype T) struct Box { T x; } 1591 // forall(otype T) f() { 1592 // Box(T *) b; b.x; 1593 // } 1594 // TODO: memberExpr->result should be exactly memberExpr->member->get_type() after substitution, so it doesn't seem like it should be necessary to apply the substitution manually. For some reason this is not currently the case. This requires more investigation. 1595 Type *memberType = memberExpr->member->get_type()->clone(); 1596 TypeSubstitution sub = objectType->genericSubstitution(); 1597 sub.apply( memberType ); 1590 1598 if ( ! isPolyType( memberType, scopeTyVars ) ) { 1591 1599 // Not all members of a polymorphic type are themselves of polymorphic type; in this case the member expression should be wrapped and dereferenced to form an lvalue … … 1595 1603 } 1596 1604 1605 delete memberType; 1597 1606 delete memberExpr; 1598 1607 return newMemberExpr;
Note: See TracChangeset
for help on using the changeset viewer.