Giter Club home page Giter Club logo

dotty's People

Contributors

abeln avatar abgruszecki avatar allanrenucci avatar anatoliykmetyuk avatar b-studios avatar biboudis avatar bishabosha avatar blaisorblade avatar brunnerant avatar bryanabate avatar darkdimius avatar duhemm avatar ennru avatar felixmulder avatar liufengyun avatar milessabin avatar neshkeev avatar nicolasstucki avatar noti0na1 avatar odersky avatar olhotak avatar olivierblanvillain avatar poechsel avatar robstoll avatar samuelgruetter avatar sjrd avatar smarter avatar theelectronwill avatar vladimirnik avatar vsalvis avatar

Watchers

 avatar  avatar  avatar

dotty's Issues

Pickling problem on @mirror

I tried to write some integration test for @mirror annotation, available on the branch shape-checking.:

import scala.annotation.mirror

object mirrors {
  @mirror def +(A: Int, B: Int): Int & Singleton = A + B
}

There is an error when pickling:

Exception in thread "main" class dotty.tools.dotc.reporting.diagnostic.messages$Error at ?: pickling difference for module class mirrors$ in /home/metaheavens/IdeaProjects/dotty/tests/pos/mirror5.scala, for details:

  diff before-pickling.txt after-pickling.txt

Here is the result of diff before-pickling.txt after-pickling.txt:

17,18c17,18
<     >@<51..58> type +[type +A >: scala.Nothing <: scala.Int@<68..71>@<68..71>@<68..71>@@(A=<68..68>), 
<       type +B >: scala.Nothing <: scala.Int@<76..79>@<76..79>@<76..79>@@(B=<76..76>)
---
>     >@<51..58> type +[+A >: scala.Nothing <: scala.Int@<68..71>@<68..71>@<68..71>@@(A=<68..68>), 
>       +B >: scala.Nothing <: scala.Int@<76..79>@<76..79>@<76..79>@@(B=<76..76>)

I tried to find why is there this diff, but I didn't succeed yet, I will continue to looking for a solution.

Unwanted type error using @mirror

I'm working with the new annotation @mirror, available on the branch shape-checking. I'm trying to develop a first draft of a Vector class as described here.

Here is the code to reproduce the issue:

import scala.annotation.mirror

object mirrors {
  @mirror def +(A: Int, B: Int): Int = A + B

  type Singleton[T] = T

  def singlify[T](implicit x: T): T = x
}

import mirrors._

class Vector[+N <: Int : Singleton](val innerArray: List[Int]) {
  def size: N = singlify[N]

  def concat[M <: Int](vec: Vector[M]): Vector[N + M] =
    new Vector[N + M](innerArray ++ vec.innerArray)(mirrors.+(size, vec.size))
}

object Test {
  def main(args: Array[String]): Unit = {
    implicit def length1: 1 = 1
    implicit def length2: 2 = 2
    val vec1: Vector[1] = new Vector[1](List(1))
    val vec2: Vector[2] = new Vector[2](List(2, 3))

    val vec3: Vector[3] = vec1.concat(vec2)
  }
}

Compiling this code will lead to the following error:

37 |    val vec3: Vector[3] = vec1.concat(vec2)
   |                          ^^^^^^^^^^^^^^^^^
   |                          found:    Vector[Int(1) + Int]
   |                          required: Vector[Int(3)]
   |                          

Whereas if I change the line:

val vec3: Vector[3] = vec1.concat(vec2)

To:

val vec3: Vector[1 + 2] = vec1.concat(vec2)
val vec4: Vector[3] = vec3

There is no errors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.