Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 09:55
    bishabosha commented #12885
  • 09:47
    epifab commented #12886
  • 09:42
    smarter closed #12886
  • 09:42
    smarter commented #12886
  • 09:32
    epifab labeled #12886
  • 09:32
    epifab opened #12886
  • 08:04
    lrytz commented #12880
  • 08:01
    syrkis starred lampepfl/dotty
  • 07:59
    griggt commented #12880
  • 07:54
    tanishiking commented #12885
  • 07:48
    tanishiking opened #12885
  • 07:41
    pikinier20 review_requested #12789
  • 07:32
    lrytz commented #12880
  • 07:16
    pikinier20 synchronize #12789
  • 07:12
    pikinier20 assigned #12868
  • 07:02
    degiorgioo starred lampepfl/dotty
  • 02:48
    changvvb synchronize #12884
  • 02:37
    changvvb synchronize #12884
  • 02:21
    changvvb synchronize #12884
  • Jun 20 20:33
    som-snytt commented #12884
Guillaume Martres
@smarter
@mbore we don't expose an API for getting an erased type, feel free to open an issue if you have a usecase for that
Dmitrii Naumenko
@unkarjedy

Is there a way to make Scala 3.0.0 work with SBT 1.3.13?
Since the release version artifact name is now scala3-library_3 and not scala3-library_3.0.0.
SBT fails to resolve it when you use scalaVersion := "3.0.0"

not found: https://repo1.maven.org/maven2/org/scala-lang/scala3-library_3.0.0/3.0.0/scala3-library_3.0.0-3.0.0.pom

and we are bound to use sbt 1.3

Guillaume Martres
@smarter
no
we only support sbt >= 1.5
Dmitrii Naumenko
@unkarjedy
BTW, if decided to break the artifact naming/versioning, why leaving this _3 suffix anyway?
We already have scala3 prefix. Isn't it too much 3 in the name?
Guillaume Martres
@smarter
it's like any other scala artefact, it has a suffix with the binary version
Dmitrii Naumenko
@unkarjedy

Is it? Compare:
scala-library-2.13.5.jar
scala3-library_3-3.0.0.jar

In Scala3 we have three 3s.
It already has -3.0.0. Why adding _3 before it?

Guillaume Martres
@smarter
all artefacts except for the compiler
which predated that convention
Dmitrii Naumenko
@unkarjedy
Ah, indeed, thanks
Seth Tisue
@SethTisue

Is there a way to make Scala 3.0.0 work with SBT 1.3.13

if you're truly determined, backport the needed changes yourself and publish your patched version yourself

Jens Halm
@jenshalm
This section in the dotty docs: https://dotty.epfl.ch/docs/internals/syntax.html#soft-keywords contains a link to https://dotty.epfl.ch/docs/internals/soft-modifier.md which gives a 404. Has the page moved somewhere?
Guillaume Martres
@smarter
I think it was split into separate pages for infix and open yeah
Jens Halm
@jenshalm
Ah, found it, it's in the reference folder now, not the internals one
DavidGoodenough
@DavidGoodenough
When using tasty-inspector I presume the idea is that we should use the same AST access as is recommended for macros, i.e. splices and quotes. I have a question about parsing from a tasty file. If I wanted to find all the (java) field definitions I could presumable look for val or var, but that would find me all of them, whether they are are top level, i.e. directly in a class and therefore fields or values in a block (which I do not want). In scala-xml terms this is the difference between / and //, i.e. search only on the current level or search all the way down the tree. What is the equivalent when using match and case for tasty inspections?
Guillaume Martres
@smarter
don't use a TreeTraverser/TreeAccumulator/TreeMap, just look into the class definition
DavidGoodenough
@DavidGoodenough
I presume this is something the compiler does when it looks up external classes, do you know of any good places to look to find examples?
Guillaume Martres
@smarter
the compiler internals aren't going to look like what you'd do from the public tasty-reflect api
DavidGoodenough
@DavidGoodenough
are there any examples that you know of for looking at the class definition from the tasty file?
and yes I do need information that is in the tasty file that is not in the java class definition, such as default values for class arguments and fields
Guillaume Martres
@smarter
the compiler testcases for tasty-inspector might be helpful: https://github.com/dotty-staging/dotty/tree/master/tests/run-custom-args/tasty-inspector
DavidGoodenough
@DavidGoodenough
thank you, I will go have a look.
DavidGoodenough
@DavidGoodenough
@smarter excellent, it is really easy to get what I need (as far as I can tell so far).
Guillaume Martres
@smarter
cool
Andrius Bentkus
@txdv
how do I run tasty inspector?
DavidGoodenough
@DavidGoodenough
@txdv it is an API not a utility. Look at the most recent link that Guillaume posted
Andrius Bentkus
@txdv
Is there some kind of tool utilizing it that prints out a tasty file in human readable format? Or do I need to use it to code it myself?
Guillaume Martres
@smarter
yeah you can pass -decompile to the compiler
Seth Tisue
@SethTisue
after a while you grow a third eye
Florian Cassayre
@FlorianCassayre
It looks like infix type operators don't work for given clauses: https://scastie.scala-lang.org/uDLXML8zQjqyCK5cnSxlvg
Eric K Richardson
@ekrich
Like the matrix?
Swoorup Joshi
@Swoorup
is there a way to way to do type level computation in repl?
1 reply
:type Int =:= Int
Swoorup Joshi
@Swoorup

Cross posting

I have got like

import cats.effect.*
import cats.*
import cats.implicits.*

type WithEnv[D, R] = D match 
  case x *: xs => x ?=> WithEnv[xs, R]
  case EmptyTuple => R
  case _ => D ?=> R

type Deps[F[_]] = (Dispatcher[F], Clock[F], Monad[F])

def findGaps[F[_]](): WithEnv[Deps[F], F[Array[Instant]]] = ???

How do I change the return signature of findGaps so that it is simpler
WithEnv[Deps, Array[Instant]]

closest I have got is like
type WithEnv[F[_], D[F[_]], R] = D[F] match 
  case x[f] *: xs => x[F] ?=> WithEnv[xs, R]
  case EmptyTuple => F[R]
  case _ => D[F] ?=> F[R]
but fails to compile on that tuple desugaring
DavidGoodenough
@DavidGoodenough

Would it be possible for documentation such as:-

https://dotty.epfl.ch/api/scala/quoted/Quotes$reflectModule.html?query=trait%20reflectModule

to be sorted alphabetically. Currently they are all over the place and it makes finding things really difficult. I understand this is not a priority, but next time some one is visiting whatever generates these pages it would be nice.

DavidGoodenough
@DavidGoodenough
If I have an annotated val and I .show its AST tree (from the tasty file) it shows the annotation. If I .toString the same AST tree there is nothing to indicate that this is annotated. I tried including a case an:Annotated in my match from which I get the ValDefs, but to no avail.
Oron Port
@soronpo
@DavidGoodenough try tree.symbol.annotations
Walter Chang
@weihsiu

is it possible to make an extension of a f-bounded type?

object FBounded:
  trait Self[A <: Self[A]]:
    def bar(): Unit = ()

  extension [A <: Self[A]](self: A)
    def foo(): Unit = ()

  trait Me extends Self[Me]

  val self: Self[Me] = new Me {}
  self.bar()
  self.foo() // fails to compile

this last line failed to compile:

[error] 12 |  self.foo()
[error]    |  ^^^^^^^^
[error]    |  value foo is not a member of FBounded.Self[FBounded.Me].
[error]    |  An extension method was tried, but could not be fully constructed:
[error]    |
[error]    |      FBounded.foo[A](self)
[error] one error found
Guillaume Martres
@smarter
@/all 👋 This channel is now closed. We're moving to gitter.im/scala/scala for user questions and https://gitter.im/scala/contributors for compiler development. Additionally, we're experimenting with Github discussions and have recently added a Metaprogramming section to https://github.com/lampepfl/dotty/discussions, feel free to drop by!
Bjorn Regnell
@bjornregnell
:thumbsup:
Jakub Kozłowski
@kubukoz:matrix.org
[m]
A sign of the times!
Eric K Richardson
@ekrich
@smarter Thanks!
bblfish
@bblfish:matrix.org
[m]
This message was deleted
Dmitrii Naumenko
@unkarjedy
This message was deleted
Nikita Gazarov
@raquo
You gotta ask in scala/scala, this channel is archived
sinanspd
@sinanspd
oh god sorry i thought i was in the contributors
my bad