Skip to content

Commit

Permalink
relaxing the fix
Browse files Browse the repository at this point in the history
  • Loading branch information
regb committed Feb 14, 2017
1 parent 5cbde5e commit 96bae6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/scala/leon/xlang/EffectsChecking.scala
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ object EffectsChecking extends UnitPhase[Program] {
getReturnedExpr(body).foreach{
case expr if effects.isMutableType(expr.getType) =>
findReferencedIds(expr).foreach(id =>
if(bindings.contains(id))
if(effects.isMutableType(id.getType) && bindings.contains(id))
ctx.reporter.fatalError(expr.getPos, "Cannot return a shared reference to a mutable object: " + expr)
)
case _ => ()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import leon.lang._

object ReturnNoAliasing1 {

case class A(var x: Int)

def f(y: Int): A = A(y)

}

0 comments on commit 96bae6a

Please sign in to comment.