Project

General

Profile

Bug #10987

Warning "warning “regex literal in condition” issued, even condition is not constant

Added by rovf (Ronald Fischer) about 5 years ago. Updated about 5 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0p598 (2014-11-13) [x86_64-cygwin]
[ruby-core:<unknown>]

Description

The following program emits the warning 'regex literal in condition':

#!/usr/bin/ruby
while gets
    print if /foo/../bar/
end

It seems that the parser does not recognize, that the "if" clause matches the regexp against $_

#1

Updated by nobu (Nobuyoshi Nakada) about 5 years ago

  • Description updated (diff)
  • Status changed from Open to Rejected

The implicit matching in a flip-flop operator is warned.

Also available in: Atom PDF