I’ve updated Spoofax from version s41636 to version s41762. I’m also updated runtime libraries from version db7b693bd9166ef4160b55c4ec110d6906d5ecdb to version 540d088bd12b361a30b69390e79112ea65e35d87.

After the update i get duplicate variable errors everywhere. Reset and reanalyze does not help. Here’s a relevant bit of my NaBL specification:

namespaces
  Module
  Variable
  ...

binding rules
  Module(name, section*) :
    defines Module name
    scopes Variable, Constructor, Sort, Arrow

  Rule(prem*, _, conc) :
  	scopes Variable

  v@Var(x) :
    defines Variable x of type ty
    where v has expected-type ty

This issue appeared after the update. The only change required by the update in the NaBL file was:

	-  SortFunCall(f, parent-ref, arg*):
	-    refers to SortFunction f in Sort parent
	-      where parent-ref has type SimpleSort(parent-ty)
	-      and parent-ty refers to Sort parent
	-      and parent has sort-kind NativeType()
	+	  SortFunCall(f, parent-ref, arg*):
	+	    refers to SortFunction f in Sort parent-ref
	+	      where parent-ref has type SimpleSort(parent-ty)
	+	      // and parent-ty resolves to Sort parent
	+	      and parent-ref has sort-kind NativeType()

An example fragment of my language which exhibits the issue:

	module build
	
	imports
	  base
	
	signature
		internal-constructors
			Foo: String -> Term
		arrows
			Term -default-> Term
	
	rules
	
		Foo(s) --> s
	
		Foo(s) --> s

Variables s and s in the first rule and the second rule are marked as duplicate in the module: Duplicate Variable s in Module build.

And its corresponding analyzed syntax:

	Module(
	  "build"{ Def(
	             URI(
	               Language("ds")
	             , [ID(NablNsModule(), "build", Unique("/Users/vladvergu/tud/slde/software/spoofax/mb-exec/org.metaborg.meta.stratego.semantics/semantics/build.ds/0"))]
	             )
	           )
	         }
	, [ Imports([Import("base"{Use(Result(37))})])
	  , Signatures(
	      [ InternalConstructors(
	          [InternalConsDecl("Foo"{ Def(
	                                     URI(
	                                       Language("ds")
	                                     , [ ID(NablNsConstructor(), "Foo", Unique("/Users/vladvergu/tud/slde/software/spoofax/mb-exec/org.metaborg.meta.stratego.semantics/semantics/build.ds/0"))
	                                       , ID(NablNsModule(), "build", Unique("/Users/vladvergu/tud/slde/software/spoofax/mb-exec/org.metaborg.meta.stratego.semantics/semantics/build.ds/0"))
	                                       ]
	                                     )
	                                   )
	                                 }, [SimpleSort("String"{Use(Result(46415))})], SimpleSort("Term"{Use(Result(46421))}))]
	        )
	      , ArrowDeclarations([ArrowDecl(SimpleSort("Term"{Use(Result(46421))}), "default"{ Def(
	                                                                                          URI(
	                                                                                            Language("ds")
	                                                                                          , [ ID(NablNsArrow(), "default", Unique("/Users/vladvergu/tud/slde/software/spoofax/mb-exec/org.metaborg.meta.stratego.semantics/semantics/build.ds/0"))
	                                                                                            , ID(NablNsModule(), "build", Unique("/Users/vladvergu/tud/slde/software/spoofax/mb-exec/org.metaborg.meta.stratego.semantics/semantics/build.ds/0"))
	                                                                                            ]
	                                                                                          )
	                                                                                        )
	                                                                                      }, SimpleSort("Term"{Use(Result(46421))}))])
	      ]
	    )
	  , Rules(
	      [ Rule(
	          []
	        , "---------"
	        , Relation(
	            Reads([])
	          , Source(Con("Foo"{Use(Result(46521))}, [Var("s"{ Def(
	                                                              URI(
	                                                                Language("ds")
	                                                              , [ ID(NablNsVariable(), "s", Unique("/Users/vladvergu/tud/slde/software/spoofax/mb-exec/org.metaborg.meta.stratego.semantics/semantics/build.ds/0"))
	                                                                , ID(NablNsModule(), "build", Unique("/Users/vladvergu/tud/slde/software/spoofax/mb-exec/org.metaborg.meta.stratego.semantics/semantics/build.ds/0"))
	                                                                ]
	                                                              )
	                                                            )
	                                                          }){(Type(), Result(46535)), (NablProp_expected-type(), Result(46528))}]){(Type(), Result(46561)), (NablProp_expected-type(), Result(46519))}, [])
	          , NamedDynamicEmitted([], "default"{Use(Result(46512))})
	          , Target(VarRef("s"{Use(Result(46444))}){(Type(), Result(46448)), (NablProp_expected-type(), Result(46520))}, [])
	          )
	        )
	      , Rule(
	          []
	        , "---------"
	        , Relation(
	            Reads([])
	          , Source(Con("Foo"{Use(Result(46521))}, [Var("s"{ Def(
	                                                              URI(
	                                                                Language("ds")
	                                                              , [ ID(NablNsVariable(), "s", Unique("/Users/vladvergu/tud/slde/software/spoofax/mb-exec/org.metaborg.meta.stratego.semantics/semantics/build.ds/1"))
	                                                                , ID(NablNsModule(), "build", Unique("/Users/vladvergu/tud/slde/software/spoofax/mb-exec/org.metaborg.meta.stratego.semantics/semantics/build.ds/0"))
	                                                                ]
	                                                              )
	                                                            )
	                                                          }){(Type(), Result(46637)), (NablProp_expected-type(), Result(46528))}]){(Type(), Result(46656)), (NablProp_expected-type(), Result(46519))}, [])
	          , NamedDynamicEmitted([], "default"{Use(Result(46512))})
	          , Target(VarRef("s"{Use(Result(46444))}){(Type(), Result(46448)), (NablProp_expected-type(), Result(46520))}, [])
	          )
	        )
	      ]
	    )
	  ]
	){ Scope(
	     [ (NablNsVariable(), URI(Language("ds"), [Anonymous("/Users/vladvergu/tud/slde/software/spoofax/mb-exec/org.metaborg.meta.stratego.semantics/semantics/build.ds/0")]))
	     , (NablNsConstructor(), URI(Language("ds"), [Anonymous("/Users/vladvergu/tud/slde/software/spoofax/mb-exec/org.metaborg.meta.stratego.semantics/semantics/build.ds/1")]))
	     , (NablNsSort(), URI(Language("ds"), [Anonymous("/Users/vladvergu/tud/slde/software/spoofax/mb-exec/org.metaborg.meta.stratego.semantics/semantics/build.ds/2")]))
	     , (NablNsArrow(), URI(Language("ds"), [Anonymous("/Users/vladvergu/tud/slde/software/spoofax/mb-exec/org.metaborg.meta.stratego.semantics/semantics/build.ds/3")]))
	     ]
	   )
	 }

I can include tasks on demand. Thank you for help.

Submitted by Vlad Vergu on 15 July 2014 at 17:37

On 15 July 2014 at 18:33 Guido Wachsmuth commented:

I run into something similar yesterday. Looks like scoping is broken.


On 15 July 2014 at 20:04 Guido Wachsmuth commented:

I found the issue. Because of ceaa19fbc0, the generation of nabl-scoping-site rules for anonymous scopes was broken. I fixed this in dbbe582189.

I reopen NaBL/108, which was resolved by ceaa19fbc0.


On 15 July 2014 at 20:04 Guido Wachsmuth closed this issue.

On 24 July 2014 at 23:21 Guido Wachsmuth reopened this issue.

On 24 July 2014 at 23:21 Guido Wachsmuth commented:

Reopening this one, since scoping for defines ... in clauses is still broken.

Log in to post comments