about summary refs log tree commit diff stats
path: root/048typecheck.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-08-02 14:26:37 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-08-02 14:27:29 -0700
commitd082b17675f40037b0e6c26384d99362acd0749e (patch)
treef0a1d0c60dfc631c726845c6b550d12af6b2c51a /048typecheck.cc
parent16ecf053f05fdc9d9f18720a0836bf725586a421 (diff)
downloadmu-d082b17675f40037b0e6c26384d99362acd0749e.tar.gz
1920 - gracefully handle typo in inferred type
Thanks Caleb Couch.
Diffstat (limited to '048typecheck.cc')
-rw-r--r--048typecheck.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/048typecheck.cc b/048typecheck.cc
index 5c22a436..d8411343 100644
--- a/048typecheck.cc
+++ b/048typecheck.cc
@@ -57,7 +57,8 @@ void deduce_missing_type(map<string, vector<type_ordinal> >& metadata, reagent&
   if (metadata.find(x.name) == metadata.end()) return;
   copy(metadata[x.name].begin(), metadata[x.name].end(), inserter(x.types, x.types.begin()));
   assert(x.properties.at(0).second.empty());
-  x.properties.at(0).second.push_back("as-before");
+  x.properties.at(0).second.resize(metadata[x.name].size());
+  x.properties.push_back(pair<string, vector<string> >("as-before", vector<string>()));
 }
 
 :(scenario transform_types_fills_in_missing_types_in_product)
@@ -80,3 +81,11 @@ recipe main [
   x:number <- copy 2
 ]
 +warn: missing type in 'x <- copy 1'
+
+:(scenario typo_in_address_type_warns)
+% Hide_warnings = true;
+recipe main [
+  y:address:charcter <- new character:type
+  *y <- copy 67
+]
++warn: unknown type: charcter