This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 118800 - Expand to multiple lines changes semantics of block with yield
Summary: Expand to multiple lines changes semantics of block with yield
Status: RESOLVED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Torbjorn Norbye
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-13 17:40 UTC by Martin Krauskopf
Modified: 2007-10-15 17:58 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Krauskopf 2007-10-13 17:40:29 UTC
Try to expand:

  def bla
    ["a", "b", "c"].each {|x| sleep 0.5; yield x}
  end

Expanded to:

  def bla
    ["a", "b", "c"].each {|x| 
      sleep 0.5; yield
      x
    }
  end

which is wrong.
Comment 1 Torbjorn Norbye 2007-10-13 19:29:04 UTC
This is caused by the YieldNode in the AST having incorrect position bounds.
Comment 2 Torbjorn Norbye 2007-10-15 17:58:40 UTC
Fixed. I'm using the same workaround I have for Mark Occurrences.

IDE:-------------------------------------------------
IDE: [10/15/07 9:57 AM] Committing started
cvs server: scheduling file `convertblocks10.rb.testHintFix19.fixed' for addition
cvs server: scheduling file `convertblocks10.rb' for addition
cvs server: use 'cvs commit' to add these files permanently
Checking in src/org/netbeans/modules/ruby/extrahints/ConvertBlockType.java;
/cvs/ruby/hints/extrahints/src/org/netbeans/modules/ruby/extrahints/ConvertBlockType.java,v  <--  ConvertBlockType.java
new revision: 1.16; previous revision: 1.15
done
Checking in test/unit/src/org/netbeans/modules/ruby/extrahints/ConvertBlockTypeTest.java;
/cvs/ruby/hints/extrahints/test/unit/src/org/netbeans/modules/ruby/extrahints/ConvertBlockTypeTest.java,v  <-- 
ConvertBlockTypeTest.java
new revision: 1.13; previous revision: 1.12
done
RCS file: /cvs/ruby/hints/extrahints/test/unit/data/testfiles/convertblocks10.rb,v
done
Checking in test/unit/data/testfiles/convertblocks10.rb;
/cvs/ruby/hints/extrahints/test/unit/data/testfiles/convertblocks10.rb,v  <--  convertblocks10.rb
initial revision: 1.1
done
RCS file: /cvs/ruby/hints/extrahints/test/unit/data/testfiles/convertblocks10.rb.testHintFix19.fixed,v
done
Checking in test/unit/data/testfiles/convertblocks10.rb.testHintFix19.fixed;
/cvs/ruby/hints/extrahints/test/unit/data/testfiles/convertblocks10.rb.testHintFix19.fixed,v  <-- 
convertblocks10.rb.testHintFix19.fixed
initial revision: 1.1
done
IDE: [10/15/07 9:57 AM] Committing finished