enum types can now be assigned values from enum with holes (#9958)
* Fixes https://github.com/nim-lang/Nim/issues/9952 * Remove workaround from vccexe
This commit is contained in:
parent
9cc4a57768
commit
6bdf7fdbce
2 changed files with 7 additions and 7 deletions
|
|
@ -90,7 +90,7 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType =
|
||||||
if sonsLen(v) == 2:
|
if sonsLen(v) == 2:
|
||||||
strVal = v.sons[1] # second tuple part is the string value
|
strVal = v.sons[1] # second tuple part is the string value
|
||||||
if skipTypes(strVal.typ, abstractInst).kind in {tyString, tyCString}:
|
if skipTypes(strVal.typ, abstractInst).kind in {tyString, tyCString}:
|
||||||
if not isOrdinalType(v.sons[0].typ):
|
if not isOrdinalType(v.sons[0].typ, allowEnumWithHoles=true):
|
||||||
localError(c.config, v.sons[0].info, errOrdinalTypeExpected)
|
localError(c.config, v.sons[0].info, errOrdinalTypeExpected)
|
||||||
x = getOrdValue(v.sons[0]) # first tuple part is the ordinal
|
x = getOrdValue(v.sons[0]) # first tuple part is the ordinal
|
||||||
else:
|
else:
|
||||||
|
|
@ -101,7 +101,7 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType =
|
||||||
strVal = v
|
strVal = v
|
||||||
x = counter
|
x = counter
|
||||||
else:
|
else:
|
||||||
if not isOrdinalType(v.typ):
|
if not isOrdinalType(v.typ, allowEnumWithHoles=true):
|
||||||
localError(c.config, v.info, errOrdinalTypeExpected)
|
localError(c.config, v.info, errOrdinalTypeExpected)
|
||||||
x = getOrdValue(v)
|
x = getOrdValue(v)
|
||||||
if i != 1:
|
if i != 1:
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@ import strutils, strtabs, os, osproc, vcvarsall, vccenv
|
||||||
type
|
type
|
||||||
VccVersion* = enum ## VCC compiler backend versions
|
VccVersion* = enum ## VCC compiler backend versions
|
||||||
vccUndefined = 0, ## VCC version undefined, resolves to the latest recognizable VCC version
|
vccUndefined = 0, ## VCC version undefined, resolves to the latest recognizable VCC version
|
||||||
vcc90 = ord(vs90) ## Visual Studio 2008 (Version 9.0)
|
vcc90 = vs90 ## Visual Studio 2008 (Version 9.0)
|
||||||
vcc100 = ord(vs100) ## Visual Studio 2010 (Version 10.0)
|
vcc100 = vs100 ## Visual Studio 2010 (Version 10.0)
|
||||||
vcc110 = ord(vs110) ## Visual Studio 2012 (Version 11.0)
|
vcc110 = vs110 ## Visual Studio 2012 (Version 11.0)
|
||||||
vcc120 = ord(vs120) ## Visual Studio 2013 (Version 12.0)
|
vcc120 = vs120 ## Visual Studio 2013 (Version 12.0)
|
||||||
vcc140 = ord(vs140) ## Visual Studio 2015 (Version 14.0)
|
vcc140 = vs140 ## Visual Studio 2015 (Version 14.0)
|
||||||
|
|
||||||
proc discoverVccVcVarsAllPath*(version: VccVersion = vccUndefined): string =
|
proc discoverVccVcVarsAllPath*(version: VccVersion = vccUndefined): string =
|
||||||
## Returns the path to the vcvarsall utility of the specified VCC compiler backend.
|
## Returns the path to the vcvarsall utility of the specified VCC compiler backend.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue