Skip to content

Commit

Permalink
Allow erased and non-erased contextual parameters in methods
Browse files Browse the repository at this point in the history
  • Loading branch information
hamzaremmal committed Apr 17, 2024
1 parent 2ba368d commit e673dd2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package transform

import core.*
import Contexts.*, Symbols.*, Types.*, Annotations.*, Constants.*, Phases.*
import Decorators.*
import StdNames.nme
import ast.untpd
import ast.tpd.*
Expand Down Expand Up @@ -115,11 +116,9 @@ object ContextFunctionResults:
else tree match
case Select(qual, name) =>
if name == nme.apply then
qual.tpe.nn.dealias match
qual.tpe.nn.widenDealias match
case defn.FunctionTypeOfMethod(mt) if mt.isContextualMethod =>
integrateSelect(qual, n + 1)
case _ if defn.isContextFunctionClass(tree.symbol.maybeOwner) => // for TermRefs
integrateSelect(qual, n + 1)
case _ =>
n > 0 && contextResultCount(tree.symbol) >= n
else
Expand Down
15 changes: 15 additions & 0 deletions tests/pos/i20206.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//> using options -experimental -Yno-experimental

import language.experimental.erasedDefinitions

erased trait A
trait B

def foo1: A ?=> B ?=> Nothing = ???
def foo2: (A, B) ?=> Nothing = ???
def foo3: (B, A) ?=> Nothing = ???

def bar: (A, B) ?=> Nothing =
foo1
foo2
foo3

0 comments on commit e673dd2

Please sign in to comment.