From da29222f86f7689227ffe12605842d18c9bf0fc1 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Tue, 23 Jun 2020 10:53:57 +0200 Subject: init checks and 'out' parameters (#14521) * I don't care about observable stores * enforce explicit initializations * cleaner code for the stdlib * stdlib: use explicit initializations * make tests green * algorithm.nim: set result explicitly * remove out parameters and bring the PR into a mergable state * updated the changelog --- compiler/transf.nim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'compiler/transf.nim') diff --git a/compiler/transf.nim b/compiler/transf.nim index bd9f567ed..10a2680ae 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -423,7 +423,7 @@ proc transformAddrDeref(c: PTransf, n: PNode, a, b: TNodeKind): PNode = if n.typ.skipTypes(abstractVar).kind != tyOpenArray: result.typ = n.typ elif n.typ.skipTypes(abstractInst).kind in {tyVar}: - result.typ = toVar(result.typ) + result.typ = toVar(result.typ, n.typ.skipTypes(abstractInst).kind) of nkHiddenStdConv, nkHiddenSubConv, nkConv: var m = n[0][1] if m.kind == a or m.kind == b: @@ -433,7 +433,7 @@ proc transformAddrDeref(c: PTransf, n: PNode, a, b: TNodeKind): PNode = if n.typ.skipTypes(abstractVar).kind != tyOpenArray: result.typ = n.typ elif n.typ.skipTypes(abstractInst).kind in {tyVar}: - result.typ = toVar(result.typ) + result.typ = toVar(result.typ, n.typ.skipTypes(abstractInst).kind) else: if n[0].kind == a or n[0].kind == b: # addr ( deref ( x )) --> x @@ -569,14 +569,14 @@ proc putArgInto(arg: PNode, formal: PType): TPutArgInto = result = putArgInto(arg[0], formal) of nkCurly, nkBracket: for i in 0..