File tree 4 files changed +36
-2
lines changed
compiler/src/dotty/tools/dotc/typer
4 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -208,7 +208,7 @@ object ErrorReporting {
208
208
i """ .
209
209
|Extension methods were tried, but the search failed with:
210
210
|
211
- | ${nested.head.explanation}"""
211
+ | ${nested.head.explanation.indented( 4 ) }"""
212
212
else if tree.hasAttachment(desugar.MultiLineInfix ) then
213
213
i """ .
214
214
|Note that ` ${tree.name}` is treated as an infix operator in Scala 3.
Original file line number Diff line number Diff line change @@ -1108,7 +1108,9 @@ trait Implicits:
1108
1108
ctx.reporter.removeBufferedMessages
1109
1109
adapted.tpe match {
1110
1110
case _ : SearchFailureType => SearchFailure (adapted)
1111
- case _ =>
1111
+ case error : PreviousErrorType if ! adapted.symbol.isAccessibleFrom(cand.ref.prefix) =>
1112
+ SearchFailure (adapted.withType(new NestedFailure (error.msg, pt)))
1113
+ case _ =>
1112
1114
// Special case for `$conforms` and `<:<.refl`. Showing them to the users brings
1113
1115
// no value, so we instead report a `NoMatchingImplicitsFailure`
1114
1116
if (adapted.symbol == defn.Predef_conforms || adapted.symbol == defn.SubType_refl )
Original file line number Diff line number Diff line change
1
+ -- [E008] Not Found Error: tests/neg/i12573.scala:23:38 ----------------------------------------------------------------
2
+ 23 |val w: Value[8] = DFBits(Value[8](8)).getDFType.width // error
3
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4
+ | value getDFType is not a member of DFBits[(8 : Int)].
5
+ | Extension methods were tried, but the search failed with:
6
+ |
7
+ | method getDFType cannot be accessed as a member of DFType.type from module class i12573$package$.
8
+ | Access to protected method getDFType not permitted because enclosing package object i12573$package
9
+ | is not a subclass of object DFType where target is defined
Original file line number Diff line number Diff line change
1
+ class Value [T <: Int ](val value : T )
2
+
3
+ sealed trait DFType :
4
+ type Width <: Int
5
+ val width : Value [Width ]
6
+
7
+ object DFType :
8
+ trait TC [T ]:
9
+ type Type <: DFType
10
+ def apply (t : T ): Type
11
+ type Aux [T , Type0 <: DFType ] = TC [T ] { type Type = Type0 }
12
+ transparent inline given ofDFType [T <: DFType ]: TC [T ] =
13
+ new TC [T ]:
14
+ type Type = T
15
+ def apply (t : T ): Type = t
16
+
17
+ extension [T , Type <: DFType ](t : T )(using tc : Aux [T , Type ])
18
+ protected def getDFType : Type = tc(t)
19
+
20
+ final case class DFBits [W <: Int ](width : Value [W ]) extends DFType :
21
+ type Width = W
22
+
23
+ val w : Value [8 ] = DFBits (Value [8 ](8 )).getDFType.width // error
You can’t perform that action at this time.
0 commit comments