When I run Dafny on the following code, it crashes:
abstract module AbstractModule1
{
type AbstractType1
}
abstract module AbstractModule2
{
import opened AM1 as AbstractModule1
datatype AbstractType2 = AbstractType2(x:AbstractType1)
}
module ConcreteModule1
{
type AbstractType1 = int
}
module ConcreteModule2 refines AbstractModule2
{
import AM1 = ConcreteModule1
}
Here's the stack trace:
DafnyPipeline.dll!Microsoft.Dafny.Translator.TrType(Microsoft.Dafny.Type type) Line 6812 C#
DafnyPipeline.dll!Microsoft.Dafny.Translator.AddDatatype(Microsoft.Dafny.DatatypeDecl dt) Line 715 C#
DafnyPipeline.dll!Microsoft.Dafny.Translator.Translate(Microsoft.Dafny.Program p) Line 517 C#
dafny.exe!Microsoft.Dafny.DafnyDriver.ProcessFiles(System.Collections.Generic.IList<string> fileNames, Microsoft.Dafny.ErrorReporter reporter, bool lookForSnapshots, string programId) Line 165 C#
dafny.exe!Microsoft.Dafny.DafnyDriver.ThreadMain(string[] args) Line 96 C#
dafny.exe!Microsoft.Dafny.DafnyDriver.Main.AnonymousMethod__0() Line 33 C#
Comments: An error is generated because AM1 in ConcreteModule2 is imported without "opened" while the import in AbstractModule2 does. They need to match.
abstract module AbstractModule1
{
type AbstractType1
}
abstract module AbstractModule2
{
import opened AM1 as AbstractModule1
datatype AbstractType2 = AbstractType2(x:AbstractType1)
}
module ConcreteModule1
{
type AbstractType1 = int
}
module ConcreteModule2 refines AbstractModule2
{
import AM1 = ConcreteModule1
}
Here's the stack trace:
DafnyPipeline.dll!Microsoft.Dafny.Translator.TrType(Microsoft.Dafny.Type type) Line 6812 C#
DafnyPipeline.dll!Microsoft.Dafny.Translator.AddDatatype(Microsoft.Dafny.DatatypeDecl dt) Line 715 C#
DafnyPipeline.dll!Microsoft.Dafny.Translator.Translate(Microsoft.Dafny.Program p) Line 517 C#
dafny.exe!Microsoft.Dafny.DafnyDriver.ProcessFiles(System.Collections.Generic.IList<string> fileNames, Microsoft.Dafny.ErrorReporter reporter, bool lookForSnapshots, string programId) Line 165 C#
dafny.exe!Microsoft.Dafny.DafnyDriver.ThreadMain(string[] args) Line 96 C#
dafny.exe!Microsoft.Dafny.DafnyDriver.Main.AnonymousMethod__0() Line 33 C#
Comments: An error is generated because AM1 in ConcreteModule2 is imported without "opened" while the import in AbstractModule2 does. They need to match.