Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pike pike
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 104
    • Issues 104
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pikelang
  • pikepike
  • Issues
  • #2768
Closed
Open
Issue created Feb 23, 2002 by Peter Bortas@zinoOwner

bogus `type mismatch' warning

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

Reported by Robert J. Budzynski, Warsaw University, Dept. of Physics Robert.Budzynski@fuw.edu.pl

Running the following script (foo.pike):
#!/usr/local/bin/pike -w
#pragma strict_types
int main(int ac, array(string) av)
{
  write(version()+"\n");
  int(-1..1) foo=0;
  if(ac>1)
    {
      if(av[1]=="1") foo++;
      else foo--;
    }
  switch(foo)
    {
    case 1: write("foo is one\n"); break;
    case -1:  write("foo is minus one\n"); break;
    case 0: write("foo is zero\n"); break;
    default: write("Bah!\n");
    }
  return 0;
}
// script ends here

I obtain the output

$ ./foo.pike xxx
foo.pike:15: Warning: Type mismatch in case.
foo.pike:15: Warning: Expected: int(-1..1)
foo.pike:15: Warning: Got     : int
Pike v7.3 release 14
foo is minus one
Assignee
Assign to
Time tracking