3/3/2017 - 1:02 AM

Avoid compilation issue.

Avoid compilation issue.

Thanks Daniel, But how do we come up with this? when we get compilation issues in Scala. 

Daniel Spiewak @djspiewak 15:08
so what happened there is the compiler lost track of the skolems
what that means is that the interface between the type inference in the pattern matcher and the full typer got confused about the types that CAS was instantiated with
when that happens, you basically just need to do less in the pattern matcher
this also has the side benefit of "extracting" the type that's in this specific instance of CAS into the t variable
note that t must be lower-case for this syntax to work
so the process to go through…
try to ascribe some types (like what we did with field)
if you see an error that involves something like _$1 or anything like it, that means the compiler lost the specific skolem instantiation
oh wow, all these steps are "1". Good job gitter

Iniyan Paramasivam @iniyanp 15:10

understood, that this s too much in pattern matcher.

Daniel Spiewak @djspiewak 15:11
anyway, once you've found that error, your final step is just pulling things out of explicit extractors (e.g. DB.CAS(fields, where, ...)) and instead match on the broad type
yeah, exactly
the pattern matcher actually has a different type checker than the rest of teh compiler
and when that type checker tries to do too much work, it gets itself into trouble
so the syntax we did basically does the minimum in the pattern matcher and slurps out the types so that the "real" type checker can do the work
and as you saw, the real type checker is a lot better at it 

Iniyan Paramasivam @iniyanp 15:12
oh ok. got it. yeah sure, will start using the real type checker. 

Daniel Spiewak @djspiewak 15:12

       _ <- I.expectU[Boolean] {
 -        case -\/(DB.CAS(schema.Topic, fields, where)) =>
 +        case -\/(cas: DB.CAS[t]) =>
            delay {
 +            val fields = cas.fields
 +            val where = cas.where
 +            val table = cas.table
              fields should have size 2
 -            forAll(fields) { field =>
 +            forAll(fields) { field: t#Update[_] =>
                inside(field) {
 -                case schema.Topic.Update(schema.Topic.state, value) =>
 +                case table.Update(schema.Topic.state, value) =>
                    value shouldEqual makeRLE(Array[Byte](1, 2, 3, 4, 5))
 +                case table.Update(schema.Topic.lastUpdated, value) =>
 +                  value should not equal 0