Coder Social home page Coder Social logo

Comments (6)

SethTisue avatar SethTisue commented on August 22, 2024 1

A consider a bug to behave differently just for defining an intermediate variable

That's an incorrect expectation, at least in general. It can perhaps be defended in specific cases, but it has to specifically defended, you can't just point at the general principle and be done, since the general principle does not exist. Type inference in Scala 3 processes entire expressions. It's normal that the overall result might be different if you first give the type checker only part of the expression to work with, forcing it to decide on an answer based on partial information, and then only later give it the rest.

from dotty.

DavidPerezIngeniero avatar DavidPerezIngeniero commented on August 22, 2024

A workaorund is to define an intermediate variable:

val p2 = (p: Map[?, ?]).asScala
p2.map { case (k, v) => (k, v) }

I consider a bug to behave differently just for defining an intermediate variable.

from dotty.

SethTisue avatar SethTisue commented on August 22, 2024

Is the issue reproducible without involving an external dependency...?

from dotty.

DavidPerezIngeniero avatar DavidPerezIngeniero commented on August 22, 2024

Is the issue reproducible without involving an external dependency...?

I don't know, but the code I've shown it is quite simple and minimalistic.

from dotty.

DavidPerezIngeniero avatar DavidPerezIngeniero commented on August 22, 2024

A consider a bug to behave differently just for defining an intermediate variable

That's an incorrect expectation, at least in general. It can perhaps be defended in specific cases, but it has to specifically defended, you can't just point at the general principle and be done, since the general principle does not exist. Type inference in Scala 3 processes entire expressions. It's normal that the overall result might be different if you first give the type checker only part of the expression to work with, forcing it to decide on an answer based on partial information, and then only later give it the rest.

At least I don´t expect different results if I split an expression using an intermediate variable.

from dotty.

SethTisue avatar SethTisue commented on August 22, 2024

I don't know, but the code I've shown it is quite simple and minimalistic.

Regardless, reproducing a bug without an external dependency is considered the standard for bug reporting in this repository, for two main reasons:

  1. It's what we need in order to turn the report into a test case that can be added to our test suite

(but perhaps even more importantly:)

  1. it often gives considerable additional insight into the nature of the problem (including insight into whether the problem is in fact a bug in Scala itself, or somehow the external dependency's fault)

from dotty.

Related Issues (20)

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.