summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2015-04-19 15:05:02 -0400
committerAdrian Thurston <thurston@complang.org>2015-04-19 15:05:02 -0400
commit247fb560e1b656cca5b98b42076aade592bedc8f (patch)
tree490a6875e81d9685961cbc95983033b961c61e44
parent0333335160ed6b9c00c5ede9502d7cd2174cf12f (diff)
downloadcolm-barracuda-v2.tar.gz
fixed identification of tree map keys, which fixes the key downrefcolm-barracuda-v2colm-barracuda-v1
-rw-r--r--src/parser.cc2
-rw-r--r--src/parsetree.h1
-rw-r--r--src/synthesis.cc3
-rw-r--r--test/map5.lm7
4 files changed, 11 insertions, 2 deletions
diff --git a/src/parser.cc b/src/parser.cc
index 7e901f6b..a056b681 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -83,7 +83,7 @@ void BaseParser::mapElDef( String name, TypeRef *keyType )
BaseParser::cflDef( ntDef, objectDef, defList );
/*
- * List element with the same name as containing context.
+ * Same name as containing context.
*/
NamespaceQual *nspaceQual = NamespaceQual::cons( curNspace() );
String id = curStruct()->objectDef->name;
diff --git a/src/parsetree.h b/src/parsetree.h
index 10b2143c..7ef6cea6 100644
--- a/src/parsetree.h
+++ b/src/parsetree.h
@@ -2400,6 +2400,7 @@ struct ObjectField
case ObjectField::RedRhsType:
case ObjectField::UserFieldType:
case ObjectField::StructFieldType:
+ case ObjectField::GenericDependentType:
return true;
default:
return false;
diff --git a/src/synthesis.cc b/src/synthesis.cc
index 99d130e1..c1eaa05e 100644
--- a/src/synthesis.cc
+++ b/src/synthesis.cc
@@ -2524,7 +2524,8 @@ void LangStmt::compile( Compiler *pd, CodeVect &code ) const
}
else {
UniqueType *resUT = pd->curFunction->typeRef->uniqueType;
- if ( !castAssignment( pd, code, resUT, 0, exprUT ) )
+ if ( resUT != pd->uniqueTypeVoid &&
+ !castAssignment( pd, code, resUT, 0, exprUT ) )
error(loc) << "return value wrong type" << endp;
}
diff --git a/test/map5.lm b/test/map5.lm
new file mode 100644
index 00000000..2897c026
--- /dev/null
+++ b/test/map5.lm
@@ -0,0 +1,7 @@
+
+new StrMap: vmap<str str>()
+StrMap->insert( "hello " ("there") )
+StrMap->insert( "friend" ("how") )
+StrMap->insert( "are " ("you") )
+
+##### EXP #####