Inlining still breaks type checking
See original GitHub issueCompiler 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:
- Created 2 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
Ascriptions are already transparent in the quoted patterns.