From a22c1f444fa76cc06fee1ae31c79986e9c3b459f Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 15 Dec 2012 22:35:16 +0100 Subject: fixes #271 --- compiler/msgs.nim | 2 +- compiler/sem.nim | 2 ++ compiler/semcall.nim | 40 +++++++++++++++++++++++++++++----------- compiler/semexprs.nim | 1 + compiler/sigmatch.nim | 34 ++++++++++++++-------------------- config/nimrod.cfg | 2 +- doc/lib.txt | 4 ++-- tests/run/titer9.nim | 6 +++--- todo.txt | 1 + 9 files changed, 54 insertions(+), 38 deletions(-) diff --git a/compiler/msgs.nim b/compiler/msgs.nim index 0f795c07d..240115817 100755 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -132,7 +132,7 @@ const errNumberOutOfRange: "number $1 out of valid range", errNnotAllowedInCharacter: "\\n not allowed in character literal", errClosingBracketExpected: "closing ']' expected, but end of file reached", - errMissingFinalQuote: "missing final \'", + errMissingFinalQuote: "missing final \' for character literal", errIdentifierExpected: "identifier expected, but found \'$1\'", errNewlineExpected: "newline expected, but found \'$1\'", errInvalidModuleName: "invalid module name: '$1'", diff --git a/compiler/sem.nim b/compiler/sem.nim index 911eafb08..c8340a139 100755 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -47,6 +47,8 @@ proc fixImmediateParams(n: PNode): PNode proc activate(c: PContext, n: PNode) proc semQuoteAst(c: PContext, n: PNode): PNode +proc IndexTypesMatch(c: PContext, f, a: PType, arg: PNode): PNode + proc typeMismatch(n: PNode, formal, actual: PType) = if formal.kind != tyError and actual.kind != tyError: LocalError(n.Info, errGenerated, msgKindToString(errTypeMismatch) & diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 962e4d3cc..0a5f19822 100755 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -84,15 +84,34 @@ proc resolveOverloads(c: PContext, n, orig: PNode, getProcHeader(best.calleeSym), getProcHeader(alt.calleeSym), args]) -proc instantiateGenericConverters(c: PContext, n: PNode, x: TCandidate) {. - noinline.}= - for i in 1 .. `_ Nimrod thread support. **Note**: This is part of the system module. Do not - import it explicitely. + import it explicitly. * `channels `_ Nimrod message passing support for threads. **Note**: This is part of the - system module. Do not import it explicitely. + system module. Do not import it explicitly. * `locks `_ Locks and condition variables for Nimrod. diff --git a/tests/run/titer9.nim b/tests/run/titer9.nim index 0d6c466c1..99874e70a 100644 --- a/tests/run/titer9.nim +++ b/tests/run/titer9.nim @@ -4,17 +4,17 @@ discard """ 0''' """ -iterator count(x: int, skip: bool): int {.closure.} = +iterator count[T](x: T, skip: bool): int {.closure.} = if skip: return x+10 else: yield x+1 if skip: return x+10 else: yield x+2 -proc takeProc(x: iterator (x: int, skip: bool): int) = +proc takeProc[T](x: iterator (x: T, skip: bool): int) = echo x(4, false) echo x(4, true) echo x(4, false) -takeProc(count) +takeProc(count[int]) diff --git a/todo.txt b/todo.txt index b162812bc..f5e6d8092 100755 --- a/todo.txt +++ b/todo.txt @@ -87,6 +87,7 @@ GC Optimizations ============= +- optimize 'if' with a constant condition - escape analysis for string/seq seems to be easy to do too; even further write barrier specialization - inlining of first class functions -- cgit 1.4.1-2-gfad0