You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Range checks are being ignored in template arguments, e.g. range and Natural, as shown below,
Example
templatetestTemplate1(i: range[0..5]) =echo i
typeRange=range[0..5]
templatetestTemplate2(i: Range) =echo i
templatetestTemplate3(i: Natural) =echo i
proctestProc(i: Range) =echo i
testTemplate1(100) # Incorrect, prints 100testTemplate2(100) # Incorrect, prints 100testTemplate3(-1) # Incorrect, prints -1#testProc(100) # Correct, raises expected error:# Error: conversion from int literal(100) to Range is invalid
Current Output
100
100
-1
Expected Output
All three template invocations should fail with an error, similarly to the proc call.
Additional Information
$ nim -v
Nim Compiler Version 1.0.4 [Windows: amd64]
Compiled at 2019-11-27
Copyright (c) 2006-2019 by Andreas Rumpf
git hash: c8998c498f5e2a0874846eb31309e1d1630faca6
active boot switches: -d:release
The text was updated successfully, but these errors were encountered:
Range checks are being ignored in template arguments, e.g.
range
andNatural
, as shown below,Example
Current Output
Expected Output
All three template invocations should fail with an error, similarly to the proc call.
Additional Information
The text was updated successfully, but these errors were encountered: