Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 05:22

    SethTisue on 2.12.x

    sbt 1.6.0-RC1 (was 1.6.0-M1) (#… (compare)

  • 05:22
    SethTisue closed #1509
  • 01:32
    SethTisue edited #1510
  • 01:32
    SethTisue synchronize #1510
  • 00:19

    SethTisue on main

    update CoC points-of-contact (#… (compare)

  • 00:19
    SethTisue closed #1307
  • 00:16
    SethTisue opened #1307
  • Nov 29 20:52
    SethTisue synchronize #2241
  • Nov 29 20:22
    SethTisue commented #2241
  • Nov 29 20:20
    SethTisue review_requested #2241
  • Nov 29 20:20
    SethTisue synchronize #2241
  • Nov 29 20:18
    SethTisue synchronize #2241
  • Nov 29 20:17
    SethTisue opened #2241
  • Nov 29 20:03
    SethTisue edited #1509
  • Nov 29 20:01
    SethTisue edited #1510
  • Nov 29 19:55
    SethTisue synchronize #9763
  • Nov 29 19:55
    SethTisue assigned #9763
  • Nov 29 19:53
    SethTisue edited #9763
  • Nov 29 19:53
    scala-jenkins milestoned #9763
  • Nov 29 19:53
    SethTisue reopened #9763
Jason Zaugg
@retronym
Scala 2.12.14 is now available. This is a maintainance release in the Scala 2.12.x series. Details: https://github.com/scala/scala/releases/tag/v2.12.14
Tomasz Godzik
@tgodzik

@smarter how would you go around finding a symbol with given name in the current scopes using the Scala 3 presentation compiler? We have two ways in Metals currently and none of them seem to work perfectly.

A very basic one we are using for Hover is ctx.findRef method here: https://github.com/scalameta/metals/blob/main/mtags/src/main/scala-3/scala/meta/internal/mtags/VersionSpecificEnrichments.scala#L15
But that seem to not find any values from the scope. Is there any correct way of doing it or are the information not available anywhere?

The test case I am trying to fix is https://github.com/scalameta/metals/blob/main/tests/cross/src/test/scala/tests/pc/InsertInferredTypeSuite.scala#L329 <- we try to automatically fix the import in case of conflicts

We also try to build the names cache here (based on the compiler code) https://github.com/scalameta/metals/blob/main/mtags/src/main/scala-3/scala/meta/internal/pc/NamesInScope.scala#L60 however I wonder if we should try to fix that or is there a better way?

None of the two find values defined in current scope.
Guillaume Martres
@smarter
@tgodzik findRef is not going to work outside of the Typer phase. dotty.tools.dotc.interactive.Completion.Completer recomputes scoping information for interactive usages, you should reuse/extend that: https://github.com/lampepfl/dotty/blob/88a5779e3d3251662c0de9887b64217171d5b9b5/compiler/src/dotty/tools/dotc/interactive/Completion.scala#L156-L169
Tomasz Godzik
@tgodzik
@smarter Thanks for confirming!
Ghost
@ghost~5fac9159d73408ce4ff3d745
When they add pragmas for conditional compilation, please make sure it expresses "before bootstrap" and "after bootstrap".
Ghost
@ghost~5fac9159d73408ce4ff3d745
@som-snytt actually there's a dotty " treat non-bootstrapped compiler as
experimental-friendly. The motivation is to compile
the standard library with experimental features enabled
at all times."
Eric K Richardson
@ekrich

Should relaxing this warning in 2.13 be considered based on the direction suggested in Scala 3 for enums below?

[info] compiling 34 Scala sources to /Users/eric/workspace/sjavatime/sjavatime/js/target/scala-2.13/classes ...
[warn] /Users/eric/workspace/sjavatime/sjavatime/shared/src/main/scala/java/time/LocalDate.scala:408:23: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method values,
[warn] or remove the empty argument list from its definition (Java-defined methods are exempt).
[warn] In Scala 3, an unapplied method like this will be eta-expanded into a function.
[warn]     val month = Month.values.takeWhile(_.firstDayOfYear(leap) <= dayOfYear).last
[warn]                       ^
[warn] /Users/eric/workspace/sjavatime/sjavatime/shared/src/main/scala/java/time/LocalDate.scala:408:23: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method values,
[warn] or remove the empty argument list from its definition (Java-defined methods are exempt).
[warn] In Scala 3, an unapplied method like this will be eta-expanded into a function.
[warn]     val month = Month.values.takeWhile(_.firstDayOfYear(leap) <= dayOfYear).last
[warn]                       ^
[warn] one warning found

lampepfl/dotty#11248

Oron Port
@soronpo
enum Color:
  case Red, Green, Blue

When I print the code after pickling, I noticed that the companion Color extends scala.deriving.Mirror.Sum.
However, the following does not pass typecheck:

val x: scala.deriving.Mirror.Sum = Color

Is there a reason for this? I would like to create an extension method that works on enum companion objects, and I would rather have a more narrow upper-bound instead of Any.

nafg
@nafg
This message was deleted
sinanspd
@sinanspd
Are there any examples/documentation of ResearchPlugin ? Especially on using them to extending the parser and/or type checker? I can not find anything on them other than a page that says "Research Plugins can do this"
Princess | April
@NthPortal
why do collections not have a specificFactory: Factory[A, C] method? it would match fromSpecificIterable well
Li Haoyi
@lihaoyi
Does anyone know if Future#zip being asymmetric in the case of failure is intentional? e.g. given val f3 = f1.zip(f2), if f1 fails and f2 is still running then f3 fails immediately, whereas if f2 fails and f1 is still running then f3 keeps running
the ordering of who-zips-who seems like something that shouldn't matter, but in this case definitely does if I want to e.g. bail out ASAP to report a failure to a user
Sébastien Doeraene
@sjrd
It's probably not intentional. I wouldn't be surprised if it even depends on the version of Scala.
zip should be symmetric.
Li Haoyi
@lihaoyi
looking at the implementation, it's because it's implemented using flatMap, which is naturally asymmetric
should be pretty easy to fix by implementing it using promises I think
Li Haoyi
@lihaoyi
seems like they're all implemented using zipWith
Martijn
@martijnhoekstra:matrix.org
[m]
I wonder whether anyone depends on the behaviour of a.zip(b) running until a finishes and whether you can reasonably call that a bug to be fixed rather than a semantic change
Li Haoyi
@lihaoyi
possibly, but it seems like something that's unlikely to be reliable enough to depend upon. It's not like people know the total ordering of how long their Futures take to run and then ensure they're in the right order before ziping or sequenceing them together
Martijn
@martijnhoekstra:matrix.org
[m]
It's not so unlikely to me there is code out there that makes assumptions like a.zip(b).onComplete(/* assumes a is complete */)Maybe not unlikely enough or broken enough not to stand in in the way of a fix, but still not so unlikely to not take it along as a consideration
Li Haoyi
@lihaoyi
I'll open a PR and include this as a consideration
Li Haoyi
@lihaoyi
here's the strawman PR scala/scala#9655
Jamie Thompson
@bishabosha
enum Color:
  case Red, Green, Blue

When I print the code after pickling, I noticed that the companion Color extends scala.deriving.Mirror.Sum.
However, the following does not pass typecheck:

val x: scala.deriving.Mirror.Sum = Color

Is there a reason for this? I would like to create an extension method that works on enum companion objects, and I would rather have a more narrow upper-bound instead of Any.

@soronpo Mirror parent classes are added to companion objects after type checking, I assume as it is only meant to be an optimisation - the API for mirrors is meant to only be accessed through implicit search

Oron Port
@soronpo
Oron Port
@soronpo
What is the reason enumeration cases cannot have bodies?
Diego E. Alonso Blas
@diesalbla
@soronpo Are you referring to the new Scala 3 enum?
Oron Port
@soronpo
Yes
sinanspd
@sinanspd
At what stage of the compilation are the mixins actually evaluated ?
If I am introducing new syntax to the compiler that "generates" a new type similar to with in A with B, can I safely ignore the occurrence of this inside case class parameters and use the existing paramClauses() and classDef() to parse ? Ideally I would like to address the syntax in the Desugar phase but it seems like case classes go through so much processing that I am not really sure anymore
(assume that the tokens and scanner have been updated to read this syntax)
Martijn
@martijnhoekstra:matrix.org
[m]
How is the dotty documentation like https://dotty.epfl.ch/docs/reference/changed-features/main-functions.html generated?
Felix Bruckmeier
@felixbr
Hi, I have a bug report for Scala 3.0.0 (regarding java compat). Where is the correct place to file this? It's not the same bug tracker as for Scala 2, right?
Seems like lampepfl/dotty is still used even though it's not called dotty anymore.
cmhteixeira
@cmhteixeira

Hello there fellow devs,

I want to share a small library I just published with you.
Its called delegate-macro.
Its is a small macro annotation to automatically delegate/proxy the implementation of an interface to a dependency.
It has been super helpful to me when I have to implement the "delegate pattern" for an interface with dozens of methods.
Maybe you will also find it useful.
I developed against Scala 2. If there seems to be interest, I will hack for Scala 3.

Repo: https://github.com/cmhteixeira/delegate-macro

Guillaume Martres
@smarter
scala 3 doesn't have macro annotations but it has https://dotty.epfl.ch/docs/reference/other-new-features/export.html
sinanspd
@sinanspd

Just out of curiosity, Are CASECLASS & CASEOBJECT worth stating as intro tokens ?

final val templateIntroTokens: TokenSet = BitSet(CLASS, TRAIT, OBJECT, ENUM, CASECLASS, CASEOBJECT)

It seems to me like the token that is captures is CASE which is then unified based on the next token (result of lookAhead())

sinanspd
@sinanspd
never mind. It doesn't compile if I remove them from the set so apparently it is used somewhere. I will go through the code again and try to find it
Rob Norris
@tpolecat
Can someone explain using even smaller words why the match type in this blog post doesn’t reduce? https://twitter.com/scala_lang/status/1402534271600967680?s=21
I don’t understand the error message.
There is a case for B.
I understand the irony of not understanding the error message in a blog post about improved error messages.
Tom Grigg
@griggt
I took it to mean that B cannot be shown to be disjoint from A, but I have no idea what I'm talking about.
Rob Norris
@tpolecat
That’s what it says but why not? X is exactly B which is unrelated to A other than both subtyping Any, which is true of any pair of Scala types.
Martijn
@martijnhoekstra:matrix.org
[m]
I think the point is that there may be some C extends A with B, but I don't understand what the point is anymore
Rob Norris
@tpolecat
But X is B. We know it’s not C.
Tom Grigg
@griggt
yes, it reduces if at least one of A or B is sealed
Martijn
@martijnhoekstra:matrix.org
[m]
there is more documentation on the documentation of match types: https://dotty.epfl.ch/docs/reference/new-types/match-types.html, which mentions
The compiler implements the following reduction algorithm:

If the scrutinee type `S` is an empty set of values (such as Nothing or String & Int), do not reduce.
Sequentially consider each pattern Pi
If S <: Pi reduce to Ti.
Otherwise, try constructing a proof that S and Pi are disjoint, or, in other words, that no value s of type S is also of type Pi.
If such proof is found, proceed to the next case (Pi+1), otherwise, do not reduce.
Rob Norris
@tpolecat
We know B is not a subtype of A.
Why do we care if there may some day be a value that’s both an A and a B?
Match types are absolutely baffling.