From ef8ddef47b6ea10c6e5e504165245ab514391056 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Fri, 24 May 2019 18:33:53 +0200 Subject: fixes #10912 (#11317) * fixes #10912 * update the tutorial examples --- compiler/cgmeth.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler') diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim index db548ccc9..ab406bc4b 100644 --- a/compiler/cgmeth.nim +++ b/compiler/cgmeth.nim @@ -56,7 +56,7 @@ proc methodCall*(n: PNode; conf: ConfigRef): PNode = type MethodResult = enum No, Invalid, Yes -proc sameMethodBucket(a, b: PSym): MethodResult = +proc sameMethodBucket(a, b: PSym; multiMethods: bool): MethodResult = if a.name.id != b.name.id: return if sonsLen(a.typ) != sonsLen(b.typ): return @@ -75,7 +75,7 @@ proc sameMethodBucket(a, b: PSym): MethodResult = if sameType(a.typ.sons[i], b.typ.sons[i]): if aa.kind == tyObject and result != Invalid: result = Yes - elif aa.kind == tyObject and bb.kind == tyObject: + elif aa.kind == tyObject and bb.kind == tyObject and (i == 1 or multiMethods): let diff = inheritanceDiff(bb, aa) if diff < 0: if result != Invalid: @@ -162,7 +162,7 @@ proc methodDef*(g: ModuleGraph; s: PSym, fromCache: bool) = var witness: PSym for i in 0 ..< L: let disp = g.methods[i].dispatcher - case sameMethodBucket(disp, s) + case sameMethodBucket(disp, s, multimethods = optMultiMethods in g.config.globalOptions) of Yes: add(g.methods[i].methods, s) attachDispatcher(s, disp.ast[dispatcherPos]) -- cgit 1.4.1-2-gfad0 l&id=4077f7d49cc52dda7610e03402f61a21a51acc0f'>commit diff stats
path: root/web/snippets/snippet1.nim
blob: 85cb98142a526f995d9197b82f911101ae6818a0 (plain) (blame)
1
2
3
4
import strutils
echo "Give a list of integers (separated by spaces): ", 
     stdin.readLine.split.each(parseInt).max,
     " is the maximum!"