From a4c3f01ad687e6b8a29db845f725c00b06016f36 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Mon, 22 Dec 2008 03:43:33 +0000 Subject: * interp/i-eval.boot (evaluateType0): Check for builtin constructors. (evaluateType): Likewise. * interp/i-spec2.boot (isType): Reject unsaturated constructors. --- src/ChangeLog | 8 ++++++++ src/interp/i-eval.boot | 8 ++++---- src/interp/i-spec2.boot | 2 +- src/testsuite/interpreter/ctor.input | 7 +++++++ 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 src/testsuite/interpreter/ctor.input (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f3b6d473..3b7e5862 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2008-12-21 Gabriel Dos Reis + + * interp/i-eval.boot (evaluateType0): Check for builtin + constructors. + (evaluateType): Likewise. + * interp/i-spec2.boot (isType): Reject unsaturated constructors. + * testsuite/interpreter/ctor.input: New. + 2008-12-20 Gabriel Dos Reis * interp/define.boot (checkRepresentation): Take a third diff --git a/src/interp/i-eval.boot b/src/interp/i-eval.boot index cf3028f3..7850f956 100644 --- a/src/interp/i-eval.boot +++ b/src/interp/i-eval.boot @@ -116,8 +116,8 @@ evaluateType0 form == op='Enumeration => form constructor? op => evaluateType1 form NIL - constructor? form => - ATOM form => evaluateType [form] + IDENTP form and niladicConstructorFromDB form => evaluateType [form] + IDENTP form and (constructor? form or form in $BuiltinConstructorNames) => throwEvalTypeMsg("S2IE0003",[form,form]) evaluateType form == @@ -150,8 +150,8 @@ evaluateType form == [op,:[['_:,sel,evaluateType type] for ['_:,sel,type] in argl]] op='Enumeration => form evaluateFormAsType form - constructor? form => - ATOM form => evaluateType [form] + IDENTP form and niladicConstructorFromDB form => evaluateType [form] + IDENTP form and (constructor? form or form in $BuiltinConstructorNames) => throwEvalTypeMsg("S2IE0003",[form,form]) evaluateFormAsType form diff --git a/src/interp/i-spec2.boot b/src/interp/i-spec2.boot index 5b3742ee..a4abcc75 100644 --- a/src/interp/i-spec2.boot +++ b/src/interp/i-spec2.boot @@ -731,7 +731,7 @@ isType t == op:=opOf t VECP op => isMap(op:= getUnname op) => NIL - op = 'Mapping => + op = 'Mapping and CONSP t => argTypes := [isType type for type in rest t] "or"/[null type for type in argTypes] => nil ['Mapping, :argTypes] diff --git a/src/testsuite/interpreter/ctor.input b/src/testsuite/interpreter/ctor.input new file mode 100644 index 00000000..a0f0f79f --- /dev/null +++ b/src/testsuite/interpreter/ctor.input @@ -0,0 +1,7 @@ +-- Test for builtin constructors at toplevel. They should +-- not crash the system. + +Record +Union +Enumeration +Mapping -- cgit v1.2.3