From 45a8ac8d4c699df4194e9c99380a2085e020e8ac Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 6 Jan 2020 07:53:09 +0100 Subject: [PATCH] Fix #7890: Add test case --- tests/neg/i7890.scala | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/neg/i7890.scala diff --git a/tests/neg/i7890.scala b/tests/neg/i7890.scala new file mode 100644 index 000000000000..a1f84ee46dde --- /dev/null +++ b/tests/neg/i7890.scala @@ -0,0 +1,16 @@ +trait Instrument { + type R + def result: R +} + +trait InstrumentFactory[I <: Instrument] { + def createInstrument: I +} + +case class Instrumented[I <: Instrument]( + instrumentation: I#R) // error + +def instrumented[D, I <: Instrument](instrumentFactory: InstrumentFactory[I]): Instrumented[I] = { + val instrument = instrumentFactory.createInstrument + Instrumented(instrument.result) +} \ No newline at end of file