Skip to content

Support for comprehension calls in Scala #150

@oswaldo

Description

@oswaldo

Is your feature request related to a problem? Please describe.

As the readme states that Scala is supported on version 3 and it isn't marked as partial, I was in doubt if this is actually a bug or an unsupported language feature due to some specific feature.

Describe the solution you'd like

If a function is called from withing a for comprehension, the call should be presented in the diagram just as a direct call would.

Take this example:

class B() {
  def bar() = Option("bar")
}

class A(b: B) {
  def foo() = {
    val r = "foo" + b.bar().getOrElse("?")
    r
  }

  def foo2() = {
    val r = for {
      x <- b.bar()
    } yield "foo" + x
    r.getOrElse("?")
  }
}

The diagram for foo() shows the bar() call but the diagram for foo2() goes directly to the getOrElse.

This way, the plugin loses a lot of its usefulness when you have functional code that makes heavy use of this language feature.

Describe alternatives you've considered

Can't see alternatives in this case except the feature needs to be implemented, fixed if it was supposed to work already, or a warning added that it is not supported due to some limitation if there is some unavoidable one.

Additional context

Tested 3.0.0-alpha.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions