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.

Context bound desugared at the wrong place in extension method

See original GitHub issue

Compiler version

3.0.0-RC1

Minimized code

trait Conv[T]

extension [T: Conv](x: T)
  def combine (y: T): T = ???

Compiler output with -Xprint:typer

    extension [T >: Nothing <: Any](x: T) def combine(y: T)(
      implicit evidence$1: test.Conv[T]
    ): T = ???

Expectation

    extension [T >: Nothing <: Any](x: T)(using x$2: test.Conv[T]) def combine(
      y: T
    ): T = ???

, obtained with “using” syntax:

extension [T](x: T)(using Conv[T])
  def combine (y: T): T = ???

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
prolativcommented, Mar 3, 2021

@odersky IMHO the suggested desugaring makes more sense and it still makes it possible to pass Conv[T] explicitly although the order of arguments would be different

"abc".combine(using given_Conv_String)("def")
0reactions
rjollycommented, Mar 4, 2021

@odersky I understand it if you don’ have time for this, but can we keep the issue open so that others can take over. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using extension methods within inline databinding context
I'm trying to use some extension methods that I use to apply consistent formatting to DateTime and Int32 - which works absolutely fine...
Read more >
Extension Methods - Scala 3 - EPFL
An extension method translates to a specially labelled method that takes the leading parameter section as its first argument list.
Read more >
Extension Methods - C# Programming Guide - Microsoft Learn
Extension methods in C# enable you to add methods to existing types without creating a new ... Binding Extension Methods at Compile Time ......
Read more >
10.1. Language options — Glasgow Haskell Compiler 8.2.2 ...
The literal -123 is, according to Haskell98 and Haskell 2010, desugared as negate (fromInteger 123). The language extension -XNegativeLiterals means that it ...
Read more >
Reactor 3 Reference Guide
The reactive programming paradigm is often presented in object-oriented languages as an extension of the Observer design pattern. You can also ...
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