diff options
-rw-r--r-- | src/ChangeLog | 7 | ||||
-rw-r--r-- | src/doc/msgs/s2-us.msgs | 2 | ||||
-rw-r--r-- | src/interp/i-map.boot | 11 | ||||
-rw-r--r-- | src/interp/i-spec1.boot | 6 | ||||
-rw-r--r-- | src/testsuite/interpreter/aw-422.input | 6 |
5 files changed, 30 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index bb01b873..c1a3bc82 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2008-08-10 Gabriel Dos Reis <gdr@cs.tamu.edu> + + Fix AW/422 + * interp/i-spec1.boot (upDeclare): Fields are not declarations. + * interp/i-map.boot (getUserIdentifiersIn): Ignore field names. + * testsuite/interpreter/aw-422.input: New. + 2008-08-09 Gabriel Dos Reis <gdr@cs.tamu.edu> * interp/pf2sex.boot (pf2Sex1): Handle more ASTs. diff --git a/src/doc/msgs/s2-us.msgs b/src/doc/msgs/s2-us.msgs index ec7bdccc..10e02373 100644 --- a/src/doc/msgs/s2-us.msgs +++ b/src/doc/msgs/s2-us.msgs @@ -167,6 +167,8 @@ S2IE0013 S2IE0014 You cannot use %1bp or any other category in a target, coercion, or package-call context. +S2IE0020 + Only identifiers can be used as Record of Union field names. S2IF0001 A $-expression must have a fully specified domain or package on the right-hand side. diff --git a/src/interp/i-map.boot b/src/interp/i-map.boot index 6ec3c5c6..5fa7d4df 100644 --- a/src/interp/i-map.boot +++ b/src/interp/i-map.boot @@ -225,7 +225,11 @@ getUserIdentifiersIn body == S_+(getUserIdentifiersInIterators itl,getUserIdentifiersIn body1) S_-(userIds,getIteratorIds itl) body is [op,:l] => - argIdList:= "append"/[getUserIdentifiersIn y for y in l] + argIdList := + -- field tags do not contribute to dependencies. + op = "Record" or (op = "Union" and l is [[":",.,.],:.]) => + append/[getUserIdentifiersIn y for [.,.,y] in l] + "append"/[getUserIdentifiersIn y for y in l] bodyIdList := CONSP op or not (GETL(op,'Nud) or GETL(op,'Led) or GETL(op,'up))=> NCONC(getUserIdentifiersIn op, argIdList) @@ -1019,7 +1023,10 @@ findLocalVars1(op,form) == form is [oper,:itrl,body] and MEMQ(oper,'(REPEAT COLLECT)) => findLocalsInLoop(op,itrl,body) form is [y,:argl] => - y is 'Record => nil + y is "Record" or (y is "Union" and argl is [[":",.,.],:.]) => + -- don't pick field tags, their are not variables. + for [tag,type] in argl repeat + findLocalsInLoop(op,type) for x in argl repeat findLocalVars1(op,x) keyedSystemError("S2IM0020",[op]) diff --git a/src/interp/i-spec1.boot b/src/interp/i-spec1.boot index 9ad10e05..b8f6121d 100644 --- a/src/interp/i-spec1.boot +++ b/src/interp/i-spec1.boot @@ -1098,6 +1098,12 @@ upDeclare t == not isLegitimateMode(mode,nil,nil) => throwKeyedMsgSP("S2IE0004",[mode],op) categoryForm?(mode) => throwKeyedMsgSP("S2IE0011",[mode, 'category],op) packageForm?(mode) => throwKeyedMsgSP("S2IE0011",[mode, 'package],op) + getAtree(op,"callingFunction") => + -- This isn't a real declaration, rather a field specification. + not IDENTP lhs => throwKeyedMsg("S2IE0020",nil) + -- ??? When we come to support field spec as type, change this. + putValue(op,objNewWrap([":",lhs,mode],mode)) + putModeSet(op,[mode]) junk := lhs is ["free",["tuple",:vars]] or lhs is ['free,['LISTOF,:vars]] or lhs is ["free",:vars] => diff --git a/src/testsuite/interpreter/aw-422.input b/src/testsuite/interpreter/aw-422.input new file mode 100644 index 00000000..69517143 --- /dev/null +++ b/src/testsuite/interpreter/aw-422.input @@ -0,0 +1,6 @@ +MayPair(T: Domain): Domain == Record(x: T, y: T) + +w: MyPair Float +x +y + |