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
  • #2727
Closed
Open
Issue created Feb 02, 2002 by Peter Bortas@zinoOwner

optional has no effect(?)

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

Reported by Martin Stjernholm mast@roxen.com

I didn't expect a type error in this program:

    class X
    {
      optional void foo();
      X x();
    }
class Y
{
  X x() {return Y();} // Line 9
}

int main() {}

In both 7.2 and 7.3, I get:

foo.pike:9:Wrong return type.
foo.pike:9:Expected: object(implements 65586)
foo.pike:9:Got     : object(is 65587)
foo.pike:9:Missing identifier "foo".
foo.pike:10:Class definition failed.
Pike: Failed to compile script:
Compilation failed.

I thought that the "optional" modifier was supposed to prevent exactly this situation.

Assignee
Assign to
Time tracking