Skip to content

Fix #9202: Use correct context in integrateOpaqueMembers #9215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4418,7 +4418,7 @@ object Types {
decls.toList.foldLeft(this) { (cinfo, sym) =>
if sym.isOpaqueAlias then
cls.setFlag(Opaque)
def force =
def force(using Context) =
if sym.isOpaqueAlias then // could have been reset because of a syntax error
sym.infoOrCompleter match
case completer: LazyType =>
Expand All @@ -4429,7 +4429,7 @@ object Types {
else defn.AnyType // dummy type in case of errors
def refineSelfType(selfType: Type) =
RefinedType(selfType, sym.name,
TypeAlias(LazyRef(_ => force, reportCycles = true)))
TypeAlias(LazyRef(force(using _), reportCycles = true)))
cinfo.selfInfo match
case self: Type =>
cinfo.derivedClassInfo(
Expand Down
5 changes: 5 additions & 0 deletions tests/pos/i9202.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
object i9202 {
opaque type SomeUnrelatedOpaque = Int
class A[T](val d: T)
extension Ex2SameNameToBeToImport on [T] (x: A[T]) { def value: T = x.d }
}