File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,10 @@ class ExplicitSelf extends MiniPhase {
29
29
! cls.is(Package ) && cls.givenSelfType.exists && ! cls.derivesFrom(tree.symbol.owner)
30
30
31
31
private def castQualifier (tree : RefTree , cls : ClassSymbol , thiz : Tree )(using Context ) =
32
- cpy.Select (tree)(thiz.cast(AndType (cls.classInfo.selfType, thiz.tpe)), tree.name)
32
+ val selfType = cls.classInfo.selfType
33
+ if selfType.classSymbols.exists(_.isValueClass) then
34
+ report.error(em " self type $selfType of $cls may not be a value class " , thiz.srcPos)
35
+ cpy.Select (tree)(thiz.cast(AndType (selfType, thiz.tpe)), tree.name)
33
36
34
37
override def transformIdent (tree : Ident )(using Context ): Tree = tree.tpe match {
35
38
case tp : ThisType =>
Original file line number Diff line number Diff line change
1
+ class B (x : Int ) {
2
+ self : Int =>
3
+ def this (a : String ) = this () // error
4
+ }
You can’t perform that action at this time.
0 commit comments