File tree Expand file tree Collapse file tree 3 files changed +30
-5
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 3 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -905,9 +905,16 @@ object CheckUnused:
905
905
def isCanEqual : Boolean =
906
906
sym.isOneOf(GivenOrImplicit ) && sym.info.finalResultType.baseClasses.exists(_.derivesFrom(defn.CanEqualClass ))
907
907
def isMarkerTrait : Boolean =
908
- sym.isClass && sym.info.allMembers.forall: d =>
909
- val m = d.symbol
910
- ! m.isTerm || m.isSelfSym || m.is(Method ) && (m.owner == defn.AnyClass || m.owner == defn.ObjectClass )
908
+ def isEmptyInterface (info : Type ): Boolean =
909
+ info.allMembers.forall: d =>
910
+ val m = d.symbol
911
+ ! m.isTerm || m.isSelfSym || m.is(Method ) && (m.owner == defn.AnyClass || m.owner == defn.ObjectClass )
912
+ if sym.isClass then isEmptyInterface(sym.info)
913
+ else if sym.is(Deferred ) then
914
+ sym.info match
915
+ case TypeBounds (_, hi) => hi == defn.AnyType || isEmptyInterface(hi)
916
+ case _ => true
917
+ else false
911
918
def isEffectivelyPrivate : Boolean =
912
919
sym.is(Private , butNot = ParamAccessor )
913
920
|| sym.owner.isAnonymousClass && ! sym.isEffectivelyOverride
Original file line number Diff line number Diff line change 1
- //> using options -Wunused:all -deprecation -feature
1
+ //> using options -Wunused:all -deprecation -feature -Werror
2
2
3
3
import java .net .URI
4
4
@@ -10,7 +10,7 @@ object circelike {
10
10
type Configuration
11
11
trait ConfiguredCodec [T ]
12
12
object ConfiguredCodec :
13
- inline final def derived [A ](using conf : Configuration )(using inline mirror : Mirror .Of [A ]): ConfiguredCodec [A ] = // warn
13
+ inline final def derived [A ](using conf : Configuration )(using inline mirror : Mirror .Of [A ]): ConfiguredCodec [A ] =
14
14
class InlinedConfiguredCodec extends ConfiguredCodec [A ]:
15
15
val codec = summonInline[Codec [URI ]] // simplification
16
16
new InlinedConfiguredCodec
Original file line number Diff line number Diff line change
1
+ //> using options -Wunused:all
2
+
3
+ trait Memberly :
4
+ def member : Int
5
+
6
+ object Members :
7
+ type MemberType <: Memberly
8
+ type Empty
9
+
10
+ object Test :
11
+ import Members .*
12
+
13
+ type MT = MemberType
14
+ def membered (using MT ) = println() // warn abstract type offers member in upper bound
15
+ def remembered (using mt : MT ) = mt.member
16
+
17
+ type Ignore = Empty
18
+ def emptily (using Ignore ) = println()
You can’t perform that action at this time.
0 commit comments