Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
pike
pike
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 105
    • Issues 105
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pikelang
  • pikepike
  • Issues
  • #4897

Closed
Open
Opened Jul 24, 2009 by Peter Bortas@zinoOwner

Overzealous compile time type check

Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=4897

Reported by Martin Stjernholm mast@roxen.com

Consider the following program:

  constant c = (["x": (["y": ({1,2,3})])]);
  int main()
  {
    werror ("%O\n", c["x"] && equal (c["x"]["y"], ({1,2,3})));
  }

It works and writes out "1". Now, if the constant mapping c is replaced with an empty one, it doesn't even compile:

  foo.pike:4:Indexing on illegal type.
  foo.pike:4:Got     : string(0..255).

The compiler could perhaps optimize the werror expression to 0, but it should compile it even if the mapping happens to be empty. Probably another problem due to an overspecified implied type for constants.

Assignee
Assign to
Pike 7.8
Milestone
Pike 7.8
Assign milestone
Time tracking
None
Due date
None
Reference: pikelang/pike#4897