question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `inline` changes semantics

See original GitHub issue

Compiler version

master

Minimized code

class A(val x: Int):
  class X:
    inline def foo() = A.this.foo()           // remove inline changes semantics

  private def foo(): Unit = println(x)

class B extends A(20):
  val a = new A(10)
  val y: Y = new Y

  class Y extends a.X

class C:
  var b = new B
  b.y.foo()  // should print 10, but prints 20

@main
def test = new C()

Output

20

Expectation

It should print 10, but it prints 20.

Initial Diagnosis

The problem seems to be related to the encoding of outer-select in inlining. The example above seems to suggest that hops alone is ambiguous.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolasstuckicommented, Jun 27, 2022

When we inline the code we probably need to find the references to the outer this references and adapt them to the inline binding in the scope where they are inlined. Use -Xprint:inlining.

I see we get this

class C() extends Object() {
    var b: B = new B()
    def b_=(x$1: B): Unit = ()
    {
      val X_this: (B#y : B#Y) = this.b.y
      val A_this: (B#a : A) = X_this.1_<outer> // suspicious reference
      A_this.inline$foo():Unit
    }
  }

We should first try to:

  • Minimize the example
  • Figure out what should be on the RHS of A_this, or in general what code should be generated
0reactions
dwijnandcommented, Jul 5, 2022

The PR seems viable. I was coming back to this to ask: seeing b isn’t stable, is inlining off of a non-stable path meant to work? I only noticed because you can’t call new on it (val y: Y = new b.Y).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inline elements - HTML: HyperText Markup Language | MDN
In this article, we'll examine HTML inline-level elements and how they differ from block-level elements.
Read more >
Copyediting with Semantic HTML | CSS-Tricks
Tracking changes is a quintessential copyediting feature for comparing versions of content. While we're used to tracking changes in a word ...
Read more >
About inline markup in the semantic cli
An inline class will always create a span element internally. So in themes, you can use the span.emph CSS selector to change how...
Read more >
Inline semantics - Free tutorial to learn HTML and CSS
3.3 Inline semantics ... You can add a title attribute to specify the abbreviation's description, which will appear by hovering the element:.
Read more >
Inline Styles in HTML - Codecademy
CSS is built to style that structured information. When inline styles are used, this clear separation between structured information and styling is blurred....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found