aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/interp/i-eval.boot8
-rw-r--r--src/interp/i-spec2.boot2
-rw-r--r--src/testsuite/interpreter/ctor.input7
4 files changed, 20 insertions, 5 deletions
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 <gdr@cs.tamu.edu>
+
+ * 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 <gdr@cs.tamu.edu>
* 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