<NME> SimpleUnionOrRecordConstructorReference.kt
<BEF> package org.elm.lang.core.resolve.reference

import org.elm.lang.core.psi.ElmNamedElement
import org.elm.lang.core.psi.ElmPsiElement
import org.elm.lang.core.resolve.ElmReferenceElement
import org.elm.lang.core.resolve.scope.ModuleScope


class SimpleUnionOrRecordConstructorReference(element: ElmReferenceElement): ElmReferenceBase<ElmReferenceElement>(element) {

    override fun getVariants(): Array<ElmNamedElement> =
            emptyArray()

    override fun resolve(): ElmPsiElement? =
            getCandidates().find { it.name == element.referenceName }

    private fun getCandidates(): Array<ElmNamedElement> {

<MSG> Cache the resolved PsiElements from a reference (#37)

* Make ElmReference resolve return a named element
* Cache resolved PsiReferences
* Make QualifiedModuleNameReference inherit from our cached base class

<DFF> @@ -1,17 +1,17 @@
 package org.elm.lang.core.resolve.reference
 
 import org.elm.lang.core.psi.ElmNamedElement
-import org.elm.lang.core.psi.ElmPsiElement
 import org.elm.lang.core.resolve.ElmReferenceElement
 import org.elm.lang.core.resolve.scope.ModuleScope
 
 
-class SimpleUnionOrRecordConstructorReference(element: ElmReferenceElement): ElmReferenceBase<ElmReferenceElement>(element) {
+class SimpleUnionOrRecordConstructorReference(element: ElmReferenceElement)
+    : ElmReferenceCached<ElmReferenceElement>(element) {
 
     override fun getVariants(): Array<ElmNamedElement> =
             emptyArray()
 
-    override fun resolve(): ElmPsiElement? =
+    override fun resolveInner(): ElmNamedElement? =
             getCandidates().find { it.name == element.referenceName }
 
     private fun getCandidates(): Array<ElmNamedElement> {

Cache the resolved PsiElements from a reference (#37)