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

regexp: LiteralPrefix returns complete=true incorrectly #11175

Closed
dvyukov opened this issue Jun 11, 2015 · 2 comments
Closed

regexp: LiteralPrefix returns complete=true incorrectly #11175

dvyukov opened this issue Jun 11, 2015 · 2 comments
Milestone

Comments

@dvyukov
Copy link
Member

@dvyukov dvyukov commented Jun 11, 2015

The following program fails:

package main

import "regexp"

func main() {
    re := regexp.MustCompile("^0^000000$")
    prefix, complete := re.LiteralPrefix()
    if complete && !re.MatchString(prefix) {
        panic("prefix:" + prefix)
    }
}
panic: prefix:0

If LiteralPrefix return complete==true, the re must match the prefix.

go version devel +b0532a9 Mon Jun 8 05:13:15 2015 +0000 linux/amd64

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jun 11, 2015
@rsc rsc changed the title regexp: LiteralPrefix lies about completeness (2) regexp: LiteralPrefix returns complete=true incorrectly Oct 14, 2015
@rsc
Copy link
Contributor

@rsc rsc commented Oct 14, 2015

This one is a real problem.

@gopherbot
Copy link

@gopherbot gopherbot commented Oct 22, 2015

CL https://golang.org/cl/16200 mentions this issue.

@rsc rsc closed this in d1eedfe Nov 25, 2015
@golang golang locked and limited conversation to collaborators Nov 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.