summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Revert "SI-6387 Clones accessor before name expansion"Eugene Vigdorchik2013-04-081-24/+11
| | | | | | This reverts commit 4e10b2c833fa846c68b81e94a08d867e7de656aa. Add 6387 test to pending and 7341 to up-to-date.
* SI-7321 Memory leak in specialize on multiple compiler runs.Eugene Vigdorchik2013-04-041-16/+12
| | | | | | | | Currently the map is declared LinkedHashMap, which doesn't align with other caching maps that are cleared on every run. Linkedness is only needed to ensure deterministic order on the generated specialized classes. The same can be accomplished by sorting generated classes a-posteriori.
* Merge pull request #2298 from retronym/ticket/6900-3Paul Phillips2013-04-036-90/+114
|\ | | | | SI-6900 Tail call elimination + dependent method type crasher
| * SI-6900 Fix tailrec for dependent method typesJason Zaugg2013-04-021-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Uncurry's info transformer could generate a MethodType with cloned parameter symbols. This type was used for the LabelDef generated in the TailCalls phase. But, the RHS of the method still contains types that refer to the original parmameter symbol. Spurious type errors ensued. I've spent a good chunk of time pursuing a more principled fix, in which we keep the symbols in the tree in sync with those in the MethodType. You can relive the procession of false dawns: https://github.com/scala/scala/pull/2248 Ultimately that scheme was derailed by a mismatch between the type parameter `T` and the skolem `T&` in the example below. trait Endo[A] { def apply(a: => A): A } class Test { def foo[T] = new Endo[(T, Unit)] { def apply(v1: => (T, Unit)) = v1 // no bridge created } } Interestingly, by removing the caching in SingleType, I got past that problem. But I didn't characterize it further. This commit sets asides the noble goal of operating in the world of types, and sledgehammers past the crash by casting the arguments to and the result of the label jump generated in TailCalls.
| * Simplify interplay between Uncurry Info- and Tree-TransformersJason Zaugg2013-04-022-19/+19
| | | | | | | | | | | | | | | | | | | | Now, the InfoTransformer is responsible for erasing the path dependent types of formal parameters, at the same place where it flattens nested method types. This is preferable to having the tree transformer overwrite the result of the info transformer, as used to be the case after my previous work on SI-6135 / 493197fc.
| * Refactor existential related code out of types.Jason Zaugg2013-04-022-69/+78
| | | | | | | | | | | | | | For imminent reuse in the subsequent commit. The binary compatibility whitelist is updated to ignore these, as they live in reflect.internal.
| * Add a cautionary comment to TreeSymSubstitutor.Jason Zaugg2013-04-021-0/+5
| |
* | Take the N^2 out of the compiler's TreeSet.Paul Phillips2013-04-031-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code responsible for this performance bug lives on somewhere in the combination of Iterator.single and Iterator.++ and is tracked by SI-7316. What this commit does is bypass the creation and composition of iterators entirely in favor of applying foreach to walking the tree. The important lesson of a bug like this: the occurrence depends on the existence of multiple implementations of basic structures like Trees. For each redundant implementation, scrutiny and testing are divided and "bug diversity" is increased. We should labor hard to structure collections in such a way that people have no good reason not to take advantage of the basic and hopefully battle-tested logic - especially when those people are us. I hope to remove util.TreeSet entirely. Until then, here is the impact of this commit on the time to compile a piece of generated test code. % time scalac3 ./target/generated/src.scala Mar 28 13:20:31 [running phase parser on src.scala] ... Mar 28 13:21:28 [running phase lazyvals on src.scala] Mar 28 13:21:28 [running phase lambdalift on src.scala] <-- WHOA Mar 28 13:25:05 [running phase constructors on src.scala] ... Mar 28 13:25:19 [running phase jvm on icode] 316.387 real, 438.182 user, 8.163 sys To this: 97.927 real, 211.015 user, 8.043 sys % time pscalac ./target/generated/src.scala Mar 28 13:18:47 [running phase parser on src.scala] ... Mar 28 13:19:44 [running phase lazyvals on src.scala] Mar 28 13:19:44 [running phase lambdalift on src.scala] Mar 28 13:19:46 [running phase constructors on src.scala] ... Mar 28 13:19:57 [running phase jvm on icode] 99.909 real, 223.605 user, 7.847 sys That's lambdalift dropping from 217 seconds to 2 seconds.
* | Merge pull request #2344 from retronym/ticket/7147Jason Zaugg2013-04-031-2/+9
|\ \ | |/ |/| SI-7147 Diagnostic for unexplained assertion in presentation compiler.
| * SI-7147 Diagnostic for unexplained assertion in presentation compiler.Jason Zaugg2013-04-021-2/+9
| | | | | | | | | | We don't have a reproducible test for this, so the best we can do is beef up the assertion to shine a little light on the problem.
* | Merge pull request #2319 from retronym/ticket/6793Paul Phillips2013-04-021-2/+9
|\ \ | | | | | | SI-6793 Don't use super param accessors if inaccessible.
| * | SI-6793 Don't use super param accessors if inaccessible.Jason Zaugg2013-03-261-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Alias replacement" has been with us since 2005 (13c59adf9). Given: package a { class C1(val v0: String) class C2(v1: String) extends a.C1(v1) { v1 } } The reference to `v1` is rewritten as `C2.super.v0()`, and no field is generated in `C2`. (Oddly, this optimization doesn't seem to kick in if these classes are in the empty package. That's probably a distinct bug.) However, this rewriting is done without consideration of the accessibility of `v0` from `C2`. This commit disables this optimization if there if `v0` is not accessible.
* | | SI-6715 Shouldn't return "" from TermNames.originalNameKato Kazuyoshi2013-04-031-1/+1
| | |
* | | Backport #2289's TermNames.unexpandedName as TermNames.originalNameKato Kazuyoshi2013-04-031-7/+10
| | | | | | | | | | | | | | | Because this implementation is more clear than 2.10.x's and it will simplify a further commit to fix SI-6715.
* | | Merge pull request #2303 from starblood/gyuhang/libdocAdriaan Moors2013-04-021-1/+1
|\ \ \ | |_|/ |/| | Correct sorting example for Ordering in scaladoc
| * | Correct sorting example for Ordering in scaladocGyuhang Shim2013-03-251-1/+1
| |/ | | | | | | | | | | | | | | Below code snippet, Sorting.quickSort(pairs)(Ordering.by[(String, Int, Int), Int](_._2) should be Sorting.quickSort(pairs)(Ordering.by[(String, Int, Int), Int](_._2))
* | Merge pull request #2321 from kzys/js-deferAdriaan Moors2013-04-012-16/+30
|\ \ | | | | | | Scaladoc: Load scripts at the bottom, and with a defer attribute
| * | Scaladoc: Load scripts at the bottom, and with a defer attributeKato Kazuyoshi2013-03-272-16/+30
| | | | | | | | | | | | | | | | | | | | | To improve latency on modern browsers (which supports defer) and old browsers: * https://www.webkit.org/blog/1395/running-scripts-in-webkit/ * http://developer.yahoo.com/blogs/ydn/posts/2007/07/high_performanc_5/
* | | Strip version suffix from diffutils.Adriaan Moors2013-03-291-1/+1
| | |
* | | Use java-diff-utils for diffing in partest.Adriaan Moors2013-03-296-1503/+26
| | | | | | | | | | | | | | | | | | | | | | | | We now use the unified diff format, hence the updated check files. It's not clear to me how partest's classpath is managed, but the approach in this commit works for the ant task and script invocation. The diffutils jar is injected in the parent classloader.
* | | Merge pull request #2292 from retronym/ticket/7285Adriaan Moors2013-03-272-4/+6
|\ \ \ | | | | | | | | SI-7285 Fix match analysis with nested objects
| * | | SI-7285 Fix match analysis with nested objects.Jason Zaugg2013-03-232-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix for SI-6146 introduced `nestedMemberType` to enumerate sealed subtypes based on the (prefixed) type of the scrutinee and the symbols of its sealed subclasses. That method needed to widen `ThisType(modSym)`s to `ModuleTypeRef(modSym)` before calling `asSeenFrom`. However, this could lead to confused in the match analysis, which sees `ModuleTypeRef` as distinct from singleton types on the same modules (after all, they aren't =:=). Spurious warnings ensued. This commit makes two changes: - conditionally re-narrow the result of `asSeenFrom` in `nestedMemberType`. - present `a.b.SomeModule.type` as `SomeModule` in warnings emitted by the pattern matcher.
* | | | Merge pull request #2291 from retronym/ticket/7290Adriaan Moors2013-03-271-5/+15
|\ \ \ \ | | | | | | | | | | SI-7290 Discard duplicates in switchable alternative patterns.
| * | | | SI-7290 Minor cleanups driven by review comments.Jason Zaugg2013-03-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - make a def a val, we only need to compute it once - add a clarifying comment - only report the first duplicate
| * | | | SI-7290 Discard duplicates in switchable alternative patterns.Jason Zaugg2013-03-231-3/+13
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pattern matcher must not allow duplicates to hit the backend when generating switches. It already eliminates then if they appear on different cases (with an unreachability warning.) This commit does the same for duplicated literal patterns in an alternative pattern: discard and warn.
* | | | Merge pull request #2288 from paulp/pr/2273-with-editsPaul Phillips2013-03-271-11/+24
|\ \ \ \ | |_|/ / |/| | | SI-6387 Clones accessor before name expansion
| * | | SI-6387 Clones accessor before name expansionEugene Vigdorchik2013-03-251-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a symbol's name is expanded due to a conflict during composition (e.g. multiple traits with same-named members, but which are not both visible at the language level in the concrete class) the compiler renames some symbols with expanded names which embed the full name of the declaring class to avoid clashes. In the rare cases when the accessor overrides the member in base class, such expansion either results in AbstractMethodError when the base method is abstract, or, even worse, can change the semantics of the program. To avoid such issues, we clone the accessor symbol, clear its ACCESSOR flag and enter the symbol with an unchanged name.
* | | | Merge pull request #2252 from soc/SI-7237-2.10Paul Phillips2013-03-251-5/+2
|\ \ \ \ | | | | | | | | | | [backport] SI-7237 Always choose ForkJoinTaskSupport
| * | | | [backport] SI-7237 Always choose ForkJoinTaskSupportSimon Ochsenreither2013-03-151-5/+2
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... on Java 6 and above. ForkJoinTaskSupport works on Hotspot, Avian and J9, while ThreadPoolTaskSupport causes the test test/files/scalacheck/parallel-collections to reliably hang on all three. We keep ThreadPoolTaskSupport around to keep the hope alive that we still have a glimpse of 1.5 support.
* | | | Merge pull request #2270 from retronym/ticket/7246-2Paul Phillips2013-03-251-14/+12
|\ \ \ \ | | | | | | | | | | SI-7246 Make $outer pointer elision Java aware
| * | | | SI-7246 Make $outer pointer elision Java awareJason Zaugg2013-03-231-14/+12
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In e0853b3, a space-saving optimization elided the outer pointer of inner classes if the the (protected) outer pointer of the immediate parent class was guaranteed to point to the same instance. But, this check failed to account for Java parent classes, which don't follow the Scala scheme. This commit disables the optimization in that case. The original test case in e0853b3 was anemic, I've fleshed it out to: - test the presense or absense of $outer pointers with Java reflection - test the optimization works in the presense of aliased and annotated aliased types. (The former worked already, the latter required a change to the implementation.) - Test the negative case when the prefixes don't line up and the subclass in fact needs its own $outer. This patch is based on work by Euguene Vigdorchik with some additions by Jason Zaugg.
* | | | Merge pull request #2306 from retronym/ticket/7299Paul Phillips2013-03-251-2/+8
|\ \ \ \ | | | | | | | | | | SI-7299 Improve error message for eta-expanding 23+ param method
| * | | | SI-7299 Improve error message for eta-expanding 23+ param methodJason Zaugg2013-03-251-2/+8
| | |_|/ | |/| | | | | | | | | | Before, we got `error: missing arguments for method f`.
* | | | Merge pull request #2257 from JamesIry/2.10.x_classfile_51Paul Phillips2013-03-256-3/+39
|\ \ \ \ | | | | | | | | | | Read version 51 (JDK 7) class files.
| * | | | Log when invokedynamic instruction is encounteredJames Iry2013-03-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on the review of https://github.com/scala/scala/pull/2257, this commit adds a debuglog when an invokedynamic instruction is found during class file parsing as a reminder that the implementation is just a place holder.
| * | | | Read version 51 (JDK 7) class files.James Iry2013-03-146-3/+38
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit makes the ClassFileReader/ICodeReader parse class files from JDK 7 (class file version 51). It does that by skipping over the method handle related entries in the constant pool and by doing some dummy processing on invoke dynamic instructions. The inliner is updated to not try to inline a method with an invoke dynamic instruction. A place holder INVOKE_DYNAMIC instruction is added to ICode but it is designed to create an error if there's ever any attempt to analyze it. Because the inliner is the only phase that ever tries to analyze ICode instructions not generated from Scala source and because Scala source will never emit an INVOKE_DYNAMIC, the place holder INVOKE_DYNAMIC should never cause any errors. A test is included that generates a class file with INVOKE_DYNAMIC and then compiles Scala code that depends on it.
* | | | SI-6580 Scaladoc: Should not close void elementsKato Kazuyoshi2013-03-251-7/+11
| |/ / |/| | | | | | | | | | | | | | | | | Because it will generate a useless element like "</img>". To made matters worse, Scaladoc used to generate the element with attributes (like </img src="...">). That's why we had SI-6580.
* | | Merge pull request #2295 from adriaanm/build-cleanup-2.10Paul Phillips2013-03-231-9/+9
|\ \ \ | | | | | | | | Build cleanup 2.10
| * \ \ Merge scala/2.10.x into build-cleanup-2.10Adriaan Moors2013-03-2317-92/+126
| |\ \ \ | | | | | | | | | | | | | | | | | | | | Conflicts: build.xml
| * | | | Sanity for build.xml: exscriptus&positus delendus est.Adriaan Moors2013-03-231-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduced copy/pasting to the best of my antabilities. The next person to duplicate anything without written permission will be sentenced to a week in xmhell. While I was at it, made sure that layering is respected. The quick phase exclusively uses the locker compiler for building. The jar task will fail when trying to create an empty jar. Replaced the crazy if/unless/depends constructs by if/then/else. Version suffix computation should now be comprehensible. I threw in some validation to make sure the various suffixes are consistent. Also, no more init/pre-foo tasks unless absolutely necessary. Introduced a couple of macros to capture the essence of staged compilation. Notes: - remove lib.extra, standardize on aux.libs - collapse *.javac.path and *.build.path - rename starr.classpath to starr.compiler.path - only repl needs jline, locker.compiler.path = locker.comp.build.path + forkjoin - more uniform build.paths (compiler = reflect + library) - uniformity means slightly bigger classpaths (e.g. forkjoin is only used in library, but inherited by compiler) - pruned: some spurious dependencies removed - compilerpathref = compiler build path - silence test.osgi, by hook or by crook - centralized clean tasks - reduce duplication in property usage - fix pack.xml to pack scaladoc/partest instead of scaladoc/scala-partest - TODO: -XDignore.symbol.file necessary for library? only needed for forkjoin? - document usage from jenkins, fix typo: partest.scalac*_*opts New targets: - quick-opt - strap-opt - test.bc - test.osgi - test.osgi.comp - test.osgi.init - test.stability-opt Removed/replaced targets: - asm.clean asm.lib asm.start - bc.run - dist.latest dist.latest.unix dist.latest.win dist.start - docs.all docs.manmaker docs.pre-comp docs.pre-continuations-plugin - docs.pre-jline docs.pre-lib docs.pre-man docs.pre-partest docs.pre-scalap - forkjoin.clean forkjoin.lib forkjoin.pack forkjoin.start - graph.clean - init.build.nopatch.release init.build.patch.release init.build.release - init.build.snapshot init.build.suffix.done init.extra.tasks - init.fail.bad.jdk init.hasbuildnum init.hasmavensuffix init.jars - init.jars.check init.maven.jars init.maven.tasks init.osgi.suffix - init.osgi.suffix.final init.osgi.suffix.snapshot init.testjava6 - init.version.done init.version.git init.version.release init.version.snapshot - init.warn.jdk7 locker.pre-comp locker.pre-lib locker.pre-reflect - locker.unlock.comp locker.unlock.lib locker.unlock.pre-comp - locker.unlock.pre-lib locker.unlock.pre-reflect locker.unlock.reflect - osgi.clean osgi.test osgi.test.comp osgi.test.init - pack.clean pack.pre-bin pack.pre-comp pack.pre-lib pack.pre-partest - pack.pre-plugins pack.pre-reflect pack.pre-scalap pack.start - palo.comp palo.lib palo.pre-bin palo.pre-comp palo.pre-lib palo.pre-reflect - palo.reflect palo.start quick.pre-bin - quick.pre-comp quick.pre-interactive quick.pre-lib quick.pre-partest - quick.pre-plugins quick.pre-reflect quick.pre-repl quick.pre-scalacheck - quick.pre-scaladoc quick.pre-scalap - sbt.clean sbt.compile sbt.done sbt.libs sbt.start - starr.clean - strap.clean strap.pre-comp strap.pre-lib strap.pre-reflect strap.start - test.debug test.pre-run
* | | | | Merge pull request #2279 from kzys/jira-7013Paul Phillips2013-03-231-3/+3
|\ \ \ \ \ | | | | | | | | | | | | SI-7013 Scaladoc: Fix StackOverflowError
| * | | | | SI-7013 Scaladoc: Fix StackOverflowErrorKato Kazuyoshi2013-03-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | No one see the result value of parse and if so, it's tail-recursive.
* | | | | | Merge pull request #2266 from paulp/issue/7251Paul Phillips2013-03-231-127/+114
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | SI-7251, compiler crash with $.
| * | | | | SI-7251, compiler crash with $.Paul Phillips2013-03-161-127/+114
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need to assert our way out of tight spots, we can issue an error. Or so I once thought. It turns out lots of assertions have been disappearing before being heard thanks to "case t: Throwable". Under such conditions, a failed assertion is a no-op, but an error is an error. The crash associated with SI-7251 is best avoided by removing the assertion, which allows an error to be issued in the normal course of events. In the course of trying to figure out the above, I cleaned up ClassfileParser somewhat.
* | | | | Merge pull request #2264 from Blaisorblade/issue/7253Paul Phillips2013-03-222-18/+18
|\ \ \ \ \ | |_|_|_|/ |/| | | | SI-7253: respect binary compatibility constraints
| * | | | SI-7253: update comments and namingPaolo G. Giarrusso2013-03-162-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | Rename isInterfaceCall -> needsInterfaceCall, which is more accurate since a receiver can't literally be an interface call.
| * | | | Remove fragile code, made redundant by previous commitPaolo G. Giarrusso2013-03-162-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The JLS requires, as an exception to generate calls referring to Object for all methods defined in Object itself; hence, whenever the method owner is Object, the call should refer to the method owner. The previous commit implemented this directly in useMethodOwner, so the special case for Object in isInterfaceCall is now redudant. Hence, remove it.
| * | | | SI-7253: respect binary compatibility constraintsPaolo G. Giarrusso2013-03-162-2/+4
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the JLS one can prove that moving a method to a superclass is a binary compatible change, both forward and backward. That's because when compiling a method call `c.foo()`, where c: C, the output descriptor *must* refer to `C` and not to the class where `foo()` is actually defined. This patch just ensures that, and adds a test comparing generated descriptors against the Javac output. The sample code is from Paul Philipps, the fix and the bytecode comparison code from me. From 2006 (9954eafffd5e60676238369ab0ed5797c92b4a7b, a fix for bug 455 in the old bug tracker http://www.scala-lang.org/sites/default/files/aladdin/displayItem.do%3Fid=455.html) until 2.9, Scalac has followed this rule "often" (that is, when C is *not* an interface). This behavior was wrong, but the bug was hard to trigger. AFAICS, this can create problems only when moving a method to a super interface in a library and expecting forward binary compatibility - that is, compiling some Scala client code against the new version of the library, and trying to run this code against the old version of the library. This change grows an interface, so it is valid only if clients are supposed to *not* implement the library. Apparently, this is so rare that nobody noticed. Since 2.10 (0bea2ab5f6b211a83bbf14ea46fe57b8163c6334), Scalac follows this rule *only* when C is an interface (I assume by oversight, since the main change was an accessibility check), so the bug was finally triggered. The new code will have to emit INVOKEINTERFACE instead of INVOKEVIRTUAL a bit more often, compared to 2.9 (but not to 2.10). I don't know whether INVOKEINTERFACE is noticeably slower (it shouldn't be); but this is the safest fix since this behavior is mandated by the JLS. If somebody disagrees and believes the 2.9 is significantly faster, IMHO he should send a separate pull request (although ProGuard is probably a better place for the change).
* | | | Merge pull request #2274 from vigdorchik/ticket/si-5699James Iry2013-03-221-7/+1
|\ \ \ \ | | | | | | | | | | SI-5699 correct java parser for annotation defs.
| * | | | SI-5699 correct java parser for annotation defs.Eugene Vigdorchik2013-03-191-7/+1
| |/ / / | | | | | | | | | | | | | | | | Correct java source parser not to insert a constructor with the type of its value method.