Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lots of absent completions #41

Closed
paulp opened this issue Mar 11, 2015 · 6 comments
Closed

lots of absent completions #41

paulp opened this issue Mar 11, 2015 · 6 comments

Comments

@paulp
Copy link

paulp commented Mar 11, 2015

@ Direct(1).<tab>
##             asInstanceOf   isInstanceOf   toString       hashCode       equals         !=             ==
size           isEmpty        elemAt         foreach        getClass       any_s          try_s          matchOr
requiring      optionally     same           fix            id_##          id_==          |>             sideEffect
isOr           doto           reflect        isNull         toRef          castTo         isClass        shortPackage
shortClass     x              __shown_rep

// Same thing
@ Seq(Direct(1)).map(_.<tab>
##             asInstanceOf   isInstanceOf   toString       hashCode       equals         !=             ==
size           isEmpty        elemAt         foreach        getClass       any_s          try_s          matchOr
requiring      optionally     same           fix            id_##          id_==          |>             sideEffect
isOr           doto           reflect        isNull         toRef          castTo         isClass        shortPackage
shortClass     x              __shown_rep

That's missing a ton of completions, which can be seen (possibly only in part) with a slightly different formulation:

@ Direct(Direct(1)).map(_.<tab>  Display all 136 possibilities? (y or n)
##                 asInstanceOf       isInstanceOf       toString           hashCode           equals
!=                 ==                 size               isEmpty            elemAt             foreach
getClass           foreachSlice       viewOps            mapIndices         foreachIntIndex    foreachIndex
containsIndex      lastNth            lastIndex          lastIntIndex       nths               indices
isPositive         isZero             intSize            longSize           byShow             byRef
byEquals           partition          span               splitAt            join               directlySlice
linearlySlice      build              force              withFilter         takeWhile          takeRight
take               map                flatMap            dropWhile          dropRight          drop
collect            ++                 :|                 |:                 xs                 toEach
foldFrom           fold               foldr              foldl              foldWithIndex      groupBy
clusterBy          dropIndex          takeToFirst        ofClass            zipView            zipIndex
zip                withSize           tail               sliceWhile         slice              mapZip
mapWithIndex       mapApply           labelOp            init               grep               gatherClass
gather             filterNot          filter             sortBy             sortDistinct       sorted
min                max                zfoldr             zfoldl             zfirst             toRefs
tabular            nonEmpty           mk_s               mkString           last               indicesWhere
indexWhere         head               forallTrue         forall             first              find
exists             count              foreachReverse     foreachWithIndex   synchronized       ne
eq                 wait               notifyAll          notify             any_s              try_s
matchOr            requiring          optionally         same               fix                id_##
id_==              |>                 sideEffect         isOr               doto               reflect
isNull             toRef              castTo             isClass            shortPackage       shortClass
x                  __shown_rep

In case you doubt:

@ Direct(1).nonEmpty
res7: psp.std.Boolean = true
@
@paulp paulp changed the title Why is the alphabet in that order - is it because of that song? lots of absent completions Mar 11, 2015
@lihaoyi
Copy link
Member

lihaoyi commented Mar 11, 2015

Yeah i dunno. If you could provide a standalone non-psp repro that'd be great, or even a repro with psp but including any @load.ivy commands necessary to pull psp into the classpath. Not the first time the presentation compiler has disappointed me ^_^

@paulp
Copy link
Author

paulp commented Mar 11, 2015

This is really easy to reproduce, or more accurately, you can't help but reproduce it.

// build.sbt
       libraryDependencies += "com.lihaoyi" %% "ammonite-repl" % "0.2.7"
initialCommands in console := "ammonite.repl.Repl.main(null)"

// a.scala
package p {
  trait Direct[A] { def map[B](f: A => B): Direct[B] }
  object Direct { def apply[A](xs: A*): Direct[A] = null }
}

// sbt console transcript
/**
@ 5.<tab>  Display all 733 possibilities? (y or n)
@ Direct(5).map(_.<tab>
getClass              ##                    asInstanceOf          isInstanceOf          toString
hashCode              equals                !=                    ==                    %
/                     *                     -                     +                     ^
&                     |                     >=                    >                     <=
<                     >>                    >>>                   <<                    unary_-
unary_+               unary_~               toDouble              toFloat               toLong
toInt                 toChar                toShort               toByte                ensuring
x                     __resultOfEnsuring    compareTo             doubleValue           floatValue
longValue             intValue              shortValue            byteValue             synchronized
ne                    eq                    wait                  notifyAll             notify
→                     ->                    __leftOfArrow         self                  toOctalString
toHexString           toBinaryString        abs                   max                   min
to                    until                 isWhole               ResultWithoutStep     signum
underlying            compare               isValidChar           isValidInt            isValidShort
isValidByte           formatted

Comes in under 733.

@lihaoyi
Copy link
Member

lihaoyi commented Mar 11, 2015

Thanks!

Perhaps I can't help but reproduce it, but it's not always obvious when things which should be there are missing. Having concrete repro examples is always nice

@paulp
Copy link
Author

paulp commented Mar 11, 2015

It's a blend of things which should be there missing, but more prominently in this example, things which should be absent being there. Unless Int has a, for instance, NoSuchFieldException member. The last few lines of completions on 5. are

Character                         UnsatisfiedLinkError              InstantiationException
UnknownError                      ArrayStoreException               VerifyError
StackTraceElement                 Deprecated                        Package
IllegalAccessException            NoClassDefFoundError              ClassFormatError
NoSuchMethodException             Thread                            ClassValue
Void                              ClassCircularityError             UnsupportedClassVersionError
FunctionalInterface               Object                            SecurityException
ThreadDeath                       LinkageError                      Comparable
InstantiationError                AssertionError                    IllegalStateException
RuntimePermission                 NoSuchMethodError

It's obviously every simple identifier being presented as Int members.

This may have no cause overlap at all with the Direct(Direct(1)).map(_. example originally given, but when the bugs are this close to the surface it's best to handle some of them so as to see the potentially more interesting ones through less static.

@lihaoyi
Copy link
Member

lihaoyi commented Apr 13, 2015

Maybe the problem fixed itself? This is what I'm seeing in trunk, and it looks about right

@ trait Direct[A] { def map[B](f: A => B): Direct[B] }; object Direct { def apply[A](xs: A*): Direct[A] = null }
defined trait Direct
defined object Direct
@ 5.
!=                  ##                  %                   &                   *
+                   -                   ->                  /                   <
<<                  <=                  ==                  >                   >=
>>                  >>>                 ResultWithoutStep   ^                   abs
asInstanceOf        byteValue           ceil                compare             compareTo
doubleValue         ensuring            eq                  equals              floatValue
floor               formatted           getClass            hashCode            intValue
isInfinite          isInfinity          isInstanceOf        isNaN               isNegInfinity
isPosInfinity       isValidByte         isValidChar         isValidInt          isValidLong
isValidShort        isWhole             longValue           max                 min
ne                  notify              notifyAll           round               self
shortValue          signum              synchronized        to                  toBinaryString
toByte              toChar              toDegrees           toDouble            toFloat
toHexString         toInt               toLong              toOctalString       toRadians
toShort             toString            unary_+             unary_-             unary_~
underlying          until               wait                |                   
@ Direct(5).
!=             ##             +              ->             ==             asInstanceOf
ensuring       eq             equals         formatted      getClass       hashCode
isInstanceOf   map            ne             notify         notifyAll      synchronized
toString       wait           
@ Direct(5).map(_.
!=                  ##                  %                   &                   *
+                   -                   ->                  /                   <
<<                  <=                  ==                  >                   >=
>>                  >>>                 ResultWithoutStep   ^                   abs
asInstanceOf        byteValue           ceil                compare             compareTo
doubleValue         ensuring            eq                  equals              floatValue
floor               formatted           getClass            hashCode            intValue
isInfinite          isInfinity          isInstanceOf        isNaN               isNegInfinity
isPosInfinity       isValidByte         isValidChar         isValidInt          isValidLong
isValidShort        isWhole             longValue           max                 min
ne                  notify              notifyAll           round               self
shortValue          signum              synchronized        to                  toBinaryString
toByte              toChar              toDegrees           toDouble            toFloat
toHexString         toInt               toLong              toOctalString       toRadians
toShort             toString            unary_+             unary_-             unary_~
underlying          until               wait                |                   
@ Seq(Direct(5)).map(_.)
!=             ##             +              ->             ==             asInstanceOf
ensuring       eq             equals         formatted      getClass       hashCode
isInstanceOf   map            ne             notify         notifyAll      synchronized
toString       wait           

@lihaoyi
Copy link
Member

lihaoyi commented Apr 13, 2015

Probably need some more stuff from your repo for this to manifest, feel free to open with a self-contained example; otherwise I probably won't fix this until i bump into it myself

@lihaoyi lihaoyi closed this as completed Apr 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants