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.

Inlining still breaks type checking

See original GitHub issue

Compiler version

3.0.0-RC2-bin-20210325-ab2664f-NIGHTLY

Problem

It is not enough to special-case Nothing (type-ascribing only trees of this type as in https://github.com/lampepfl/dotty/pull/11917). In principle, all inlined parameters may require a type annotation. This is because removing type annotations in Scala can break type checking, as subtyping is not transitive.

Minimized code

type A
class B { def foo = 0 }
trait Ev { type T >: A <: B }

inline  // commenting this fixes the error
def test(ev: Ev)(x: ev.T): Int = x.foo

def trial(ev: Ev, a: A) = {
  test(ev)(a)  // foo cannot be accessed as a member of (a : A) from module class main$package$.
}

Expectation

If it type-checks without inline, it should type-check with inline too. In particular, I assume that non-transparent inline is not supposed to interfere with type checking in any way. Is that a correct assumption?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
oderskycommented, Mar 29, 2021

I think the crucial thing to make progress is really to make type ascriptions transparent in the quoted APIs. So let me reassign to @nicolasstucki.

0reactions
nicolasstuckicommented, Mar 30, 2021

Ascriptions are already transparent in the quoted patterns.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there still a use for inline? [duplicate] - Stack Overflow
No matter how you designate a function as inline , it is a request that the compiler is allowed to ignore: the compiler...
Read more >
Declaration emit should not inline type definitions #37151
Actual behavior: Today, declaration emit for parent.ts inlines the types and eliminates the import of the child.d.ts type definition.
Read more >
Scalar UDF Inlining - SQL Server - Microsoft Learn
Scalar UDF Inlining feature to improve performance of queries that invoke scalar UDFs in SQL Server (starting with SQL Server 2019).
Read more >
The compiler is unable to type-che… | Apple Developer Forums
Full error: The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
Read more >
Inline functions | Kotlin
break and continue are not yet available in inlined lambdas, but we are planning to support them, too. Reified type parameters. Sometimes you ......
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