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 153238 - RubyTypeAnalyzer inferencing multiple types
Summary: RubyTypeAnalyzer inferencing multiple types
Status: RESOLVED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: Editing (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Martin Krauskopf
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-14 18:44 UTC by Martin Krauskopf
Modified: 2009-02-19 23:02 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Krauskopf 2008-11-14 18:44:05 UTC
Then providing union their super-classes in the code-completion, somehow emphasizing intersection over the rest. And
bending the whole infrastructure (mainly/only(?) code completion).

As a prototype I want to make it work with:

  var = nil
  if cond1
    var = "some string"
    var = {:a => 1, :b => 2}
  else
    var = [1, 2, 3]
  end
  p var.in| # var inferred to { Hash, Array } without { NilClass, String }

and e.g.:

  var = nil
  if cond1
    var = "some string"
  end
  p var.in| # var inferred to { NilClass, String }

and e.g.

  var = nil
  begin
    var = "some string"
  end
  p var.in| # var inferred to { NilClass, String }

So few various cases to handle differently.
Comment 1 Martin Krauskopf 2008-11-14 18:48:11 UTC
More or less STARTED, will continue on Tuesday when back from mountains ;)
Comment 2 Martin Krauskopf 2008-11-21 14:12:34 UTC
I hope I did not destroy too much on my first touch in the areas ;)

Changeset #c87a5a2c1f16
Message:
  #153238: RubyTypeAnalyzer inferencing multiple types. Partial IfNode type inference.

  - to be enhanced about cases presented by RubyTypeAnalyzerTest#FIXME_*
    methods, need to better cooperate between individual scopes. But
    still, relatively decent wrt. to real usage.
  - basic switch of infrastructure to the multiple types inference

Changeset #f50d5592e214
Message:
  When there are more possible types for (assignments to) one variable and one
  of them cannot be inferred add 'null' to the types collection, i.e. append
  all 'general' methods. See the test-case for reasoning.
Comment 3 Quality Engineering 2008-11-23 17:06:57 UTC
Integrated into 'main-golden', will be available in build *200811231401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/c87a5a2c1f16
User: Martin Krauskopf <mkrauskopf@netbeans.org>
Log: #153238: RubyTypeAnalyzer inferencing multiple types. Partial IfNode type inference.

- to be enhanced about cases presented by RubyTypeAnalyzerTest#FIXME_*
  methods, need to better cooperate between individual scopes. But
  still, relatively decent wrt. to real usage.
- basic switch of infrastructure to the multiple types inference