@@ -4,7 +4,6 @@ package transform
4
4
import core ._
5
5
import Types ._
6
6
import Symbols ._
7
- import SymDenotations ._
8
7
import Contexts ._
9
8
import Flags ._
10
9
import StdNames ._
@@ -13,7 +12,8 @@ import SymUtils._
13
12
/** Methods that apply to user-defined value classes */
14
13
object ValueClasses {
15
14
16
- def isDerivedValueClass (d : SymDenotation )(implicit ctx : Context ) = {
15
+ def isDerivedValueClass (sym : Symbol )(implicit ctx : Context ): Boolean = {
16
+ val d = sym.denot
17
17
! ctx.settings.XnoValueClasses .value &&
18
18
! d.isRefinementClass &&
19
19
d.isValueClass &&
@@ -33,27 +33,27 @@ object ValueClasses {
33
33
}
34
34
35
35
/** The member of a derived value class that unboxes it. */
36
- def valueClassUnbox (d : ClassDenotation )(implicit ctx : Context ): Symbol =
36
+ def valueClassUnbox (cls : ClassSymbol )(implicit ctx : Context ): Symbol =
37
37
// (info.decl(nme.unbox)).orElse(...) uncomment once we accept unbox methods
38
- d .classInfo.decls.find(_.is(ParamAccessor ))
38
+ cls .classInfo.decls.find(_.is(ParamAccessor ))
39
39
40
40
/** For a value class `d`, this returns the synthetic cast from the underlying type to
41
41
* ErasedValueType defined in the companion module. This method is added to the module
42
42
* and further described in [[ExtensionMethods ]].
43
43
*/
44
- def u2evt (d : ClassDenotation )(implicit ctx : Context ): Symbol =
45
- d .linkedClass.info.decl(nme.U2EVT ).symbol
44
+ def u2evt (cls : ClassSymbol )(implicit ctx : Context ): Symbol =
45
+ cls .linkedClass.info.decl(nme.U2EVT ).symbol
46
46
47
47
/** For a value class `d`, this returns the synthetic cast from ErasedValueType to the
48
48
* underlying type defined in the companion module. This method is added to the module
49
49
* and further described in [[ExtensionMethods ]].
50
50
*/
51
- def evt2u (d : ClassDenotation )(implicit ctx : Context ): Symbol =
52
- d .linkedClass.info.decl(nme.EVT2U ).symbol
51
+ def evt2u (cls : ClassSymbol )(implicit ctx : Context ): Symbol =
52
+ cls .linkedClass.info.decl(nme.EVT2U ).symbol
53
53
54
54
/** The unboxed type that underlies a derived value class */
55
- def underlyingOfValueClass (d : ClassDenotation )(implicit ctx : Context ): Type =
56
- valueClassUnbox(d ).info.resultType
55
+ def underlyingOfValueClass (sym : ClassSymbol )(implicit ctx : Context ): Type =
56
+ valueClassUnbox(sym ).info.resultType
57
57
58
58
/** Whether a value class wraps itself */
59
59
def isCyclic (cls : ClassSymbol )(implicit ctx : Context ): Boolean = {
0 commit comments