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

Strange compiler errors mentioning opaque Domain type after Dsl transform #118

Open
benhutchison opened this issue May 4, 2018 · 6 comments

Comments

@benhutchison
Copy link

Was able to reproduce in a small example, although not very practical:
https://scastie.scala-lang.org/GLQ08KWRSaW2QtlNob8Hxg

type mismatch;
 found   : org.atnos.eff.Eff[R,a3.Foo]
 required: org.atnos.eff.Eff[R,_1.Foo] where val _1: Module.this.Nextie

type mismatch;
 found   : org.atnos.eff.Eff[R,Any]
 required: Domain
@Atry
Copy link
Collaborator

Atry commented May 4, 2018

I minimized it to https://scastie.scala-lang.org/Atry/65lyloFqTQOZnT9MlyHFEQ/1

import com.thoughtworks.dsl.keywords.Monadic, Monadic.implicitMonadic
import com.thoughtworks.dsl.domains.cats._

import cats.implicits._

import shapeless.tag
import shapeless.tag.@@

import org.atnos.eff._
import org.atnos.eff.all._
import org.atnos.eff.syntax.all._

object Example extends App {



  trait Module {

    abstract class Nextie {
      type Foo 

      def foo[R: _option]: Eff[R, Foo] 
    }

    def foo[R: _option]: Eff[R, Nextie] 

    def tryResolveNext2[R: _option]: Eff[R, Unit] =  {
      val outer = !foo
      
      val f = !outer.foo

      ().pureEff[R]
    }

  } 
}

@Atry
Copy link
Collaborator

Atry commented May 4, 2018

The cause is scala/bug#8500, resetLocalAttrs does not work with existential types

@Atry
Copy link
Collaborator

Atry commented May 4, 2018

I don't know if we can workaround it

@Atry
Copy link
Collaborator

Atry commented May 4, 2018

type mismatch;
 found   : org.atnos.eff.Eff[R,outer.Foo]
 required: org.atnos.eff.Eff[R,outer.Foo]

The error message is horrible, indicating the two outers have different symbols.

@Atry
Copy link
Collaborator

Atry commented May 4, 2018

An workaround is avoiding the usage of abstract types:

import com.thoughtworks.dsl.keywords.Monadic, Monadic.implicitMonadic
import com.thoughtworks.dsl.domains.cats._

import cats.implicits._

import shapeless.tag
import shapeless.tag.@@

import org.atnos.eff._
import org.atnos.eff.all._
import org.atnos.eff.syntax.all._

object Example extends App {

  trait Module {

    abstract class Nextie {
      type Foo
      
      def foo[R: _option]: Eff[R, Foo] 
    }
    
    object Nextie {
      type Aux[Foo0] = Nextie {
        type Foo = Foo0
      }
    }

    def foo[R: _option, Foo]: Eff[R, Nextie.Aux[Foo]] 

    def tryResolveNext2[R: _option, Foo]: Eff[R, Unit] =  {
      val outer = !foo[R, Foo]
      
      val f = !outer.foo

      ().pureEff[R]
    }

  } 
}

https://scastie.scala-lang.org/Atry/PThXCuU0Qty96YcYL9tVvA

@benhutchison
Copy link
Author

benhutchison commented May 4, 2018 via email

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