Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect error if array field of seq type is not set #6982

Closed
survivorm opened this issue Dec 28, 2017 · 0 comments · Fixed by #23532
Closed

Incorrect error if array field of seq type is not set #6982

survivorm opened this issue Dec 28, 2017 · 0 comments · Fixed by #23532
Assignees

Comments

@survivorm
Copy link
Contributor

survivorm commented Dec 28, 2017

import sets
import tables
type 


  eResearchType* = enum
    tResearch,
    tEngineering,
    tMixed,
  eDevelopmentField* = enum
    # Science fields
    sciBiology,
    sciCemistry,
    sciPhysics,
    sciMathematics,
    sciSystemsScience,
    sciEconomics,
    sciHealthScience,
    sciPsycology,
    sciAstronomy,
    sciLinguistics,
    sciPhylosophy,
    sciPoliticalScience,
    sciSociology,
    sciEducation,
    sciArchitecture,
    sciCognitiveSciences,
    sciComputerScience,
    sciMilitaryScience,
    sciXenoBiology,
    # After here, Enginering fields
    engAeronautics,
    engBiomedical,
    engComputer,
    engChemical,
    engElectical,
    engMechanical,
    engNuclear,
    engPolymer,
    engSoftware,
    engSystem

  PropertyKind = enum
      tInt,
      tFloat,
      tBool,
      tString,
      tArray,
      eRType,
      sTags,
      eDField

  Property = ref PropertyObj
  PropertyObj = object
    case kind: PropertyKind
    of tInt: intValue: int
    of tFloat: floatValue: float
    of tBool: boolValue: bool
    of tString: stringValue: string
    of tArray: arrayValue: seq
    of eRType:
      eRTypeValue: eResearchType
    of sTags: setValue: OrderedSet[eDevelopmentField]
    of eDField: eDTypeValue: eDevelopmentField

  ProjectProperties = ref ProjectPropertiesObj

  ProjectPropertiesObj = object
    nodes: OrderedTableRef[string, Property]


var p = Property(kind: tFloat, floatValue: 2.0)

trying to make produces the error:

Hint: test [Processing]
Hint: hashes [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: math [Processing]
Hint: algorithm [Processing]
test.nim(72, 5) Error: invalid type: 'T' in this context: 'Property'
(1 of 1) error: invalid type: 'T' in this context: 'Property'

Which is wery confusing. In some moment i had probably the same error telling something about bad template initialization, which is even more confusing (now i can't reproduce it)

In case it's not clear: error string is of tArray: arrayValue: seq, there seq should have [type] attribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants