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

Bug processing typechecked package and module decs #105

Closed
jvasileff opened this issue Dec 7, 2015 · 9 comments
Closed

Bug processing typechecked package and module decs #105

jvasileff opened this issue Dec 7, 2015 · 9 comments
Assignees
Labels
Milestone

Comments

@jvasileff
Copy link
Member

Section 6.10.2. Package and module references allows package-name-less package reference expressions (package):

If there is no explicit package name, the package reference is to the package in which the package reference expression occurs.

but ceylon.ast.redhat blows up with:

Exception in thread "main" ceylon.language.AssertionError "Assertion failed
    violated nonempty components = CeylonIterable(fullPackageName.identifiers).collect(propagateUpdate(pIdentifierToCeylon, update))"
    at ceylon.ast.redhat.fullPackageNameToCeylon_.fullPackageNameToCeylon(FullPackageName.ceylon:17)
    at ceylon.ast.redhat.packageDecToCeylon_.packageDecToCeylon(PackageDec.ceylon:16)
    at ceylon.ast.redhat.decToCeylon_.decToCeylon(Dec.ceylon:32)
    at ceylon.ast.redhat.primaryToCeylon_.primaryToCeylon(Primary.ceylon:47)

This is supported by the api of PackageDec, as packageName is optional.

@jvasileff jvasileff changed the title Allow package PackageDecs Bug processing package PackageDecs Dec 7, 2015
@lucaswerkmeister lucaswerkmeister self-assigned this Dec 7, 2015
@lucaswerkmeister lucaswerkmeister added this to the Next release milestone Dec 7, 2015
@jvasileff
Copy link
Member Author

@lucaswerkmeister re you're Gitter question

it looks like you’ve managed to get a package literal with a non-null, but empty import path
how?

it must be that the type checker fills in this info when full type checking is performed. For the program:

Anything p = `package`;

I get:

$ ceylon compile-dart --verbose=ast,rhAst
...
-- Redhat AST simple/run.ceylon
+  [CompilationUnit] (1:0-1:22)
|  +  [ImportList]
|  +  [AttributeDeclaration] (1:0-1:22) : value p => Anything
|  |  +  [AnnotationList]
|  |  + p [Identifier] (1:9-1:9)
|  |  +  [BaseType] (1:0-1:7) : Anything : class Anything()
|  |  |  + Anything [Identifier] (1:0-1:7)
|  |  + = [SpecifierExpression] (1:11-1:21)
|  |  |  +  [Expression] (1:13-1:21) : Package
|  |  |  |  + `` [PackageLiteral] (1:13-1:21) : Package
|  |  |  |  |  +  [ImportPath]

------------------------------------------------------------
                    ** Compiler bug! **
------------------------------------------------------------
Assertion failed
    violated nonempty components = CeylonIterable(fullPackageName.identifiers).collect(propagateUpdate(pIdentifierToCeylon, update))

was encountered while compiling the file:

    source/simple/run.ceylon
------------------------------------------------------------
Exception in thread "main" ceylon.language.AssertionError "Assertion failed
    violated nonempty components = CeylonIterable(fullPackageName.identifiers).collect(propagateUpdate(pIdentifierToCeylon, update))"
    at ceylon.ast.redhat.fullPackageNameToCeylon_.fullPackageNameToCeylon(FullPackageName.ceylon:17)
    at ceylon.ast.redhat.packageDecToCeylon_.packageDecToCeylon(PackageDec.ceylon:16)
    at ceylon.ast.redhat.decToCeylon_.decToCeylon(Dec.ceylon:32)

@jvasileff
Copy link
Member Author

Ah, looks like ExpressionVisitor.java is the null hater (or null burier?):

https:/ceylon/ceylon/blob/3d92c0cb6faf9b5d2c93635f82b27ee1c8e26c89/typechecker/src/com/redhat/ceylon/compiler/typechecker/analyzer/ExpressionVisitor.java#L8841

Module literals may also be affected.

@lucaswerkmeister
Copy link
Member

Indeed it does: ExpressionVisitor.java:8847. I thought it would create a proper import path with the correct components, but it looks like it doesn’t. Alright.

@jvasileff
Copy link
Member Author

Github tells me I beat you by 1s :)

@lucaswerkmeister
Copy link
Member

GitHub doesn’t even tell me second-precise timestamps :(

@jvasileff
Copy link
Member Author

So yes, Anything p = `module`; also fails with:

Exception in thread "main" ceylon.language.AssertionError "Assertion failed
    violated nonempty components = CeylonIterable(fullPackageName.identifiers).collect(propagateUpdate(pIdentifierToCeylon, update))"
    at ceylon.ast.redhat.fullPackageNameToCeylon_.fullPackageNameToCeylon(FullPackageName.ceylon:17)
    at ceylon.ast.redhat.moduleDecToCeylon_.moduleDecToCeylon(ModuleDec.ceylon:16)
    at ceylon.ast.redhat.decToCeylon_.decToCeylon(Dec.ceylon:33)
    at ceylon.ast.redhat.primaryToCeylon_.primaryToCeylon(Primary.ceylon:47)

@lucaswerkmeister lucaswerkmeister changed the title Bug processing package PackageDecs Bug processing typechecked package and module decs Dec 7, 2015
@lucaswerkmeister
Copy link
Member

Should be fixed in branch fix105, can you try it out?

(class and interface should be fine afaict.)

@jvasileff
Copy link
Member Author

works great, thanks!

BTW, a nice tool for testing this sort of thing is ceylon compile-dart --verbose=ast,rhAst :)

lucaswerkmeister added a commit that referenced this issue Dec 8, 2015
@lucaswerkmeister
Copy link
Member

Alright, pushed to master then :)

And it seems like your compiler is a great way to debug ceylon.ast on
typechecked ASTs, so I guess I’ll install it :D

On 08.12.2015 01:17, John Vasileff wrote:

works great, thanks!

BTW, a nice tool for testing this sort of thing is |ceylon
compile-dart --verbose=ast,rhAst| :)


Reply to this email directly or view it on GitHub
#105 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants