peachpiecompiler / peachpie

PeachPie - the PHP compiler and runtime for .NET and .NET Core
https://www.peachpie.io
Apache License 2.0
2.31k stars 201 forks source link

Build: Index was outside the bounds of the array #1063

Closed dennismarksbury closed 1 year ago

dennismarksbury commented 1 year ago

After working out what I believe to be all the code issues, I am getting the following error when I try to build the project

Environment: Visual Studio 2019 Peachpie SDK 1.0.23

Reproduce the error at: https://github.com/dennismarksbury/LaravelOnPeachPie

Error:

Severity    Code    Description Project File    Line    Suppression State
Error       Index was outside the bounds of the array.
   at Pchp.CodeAnalysis.CodeGen.CodeGenerator.EmitDeclareTypeByDependencies(ImmutableArray`1 versions, KeyValuePair`2[] dependency_handle, Int32 index, Dictionary`2 dependencies, NamedLabel lblDone, NamedLabel lblFail)
   at Pchp.CodeAnalysis.CodeGen.CodeGenerator.EmitDeclareTypeByDependencies(ImmutableArray`1 versions, KeyValuePair`2[] dependency_handle, Int32 index, Dictionary`2 dependencies, NamedLabel lblDone, NamedLabel lblFail)
   at Pchp.CodeAnalysis.CodeGen.CodeGenerator.EmitDeclareTypeByDependencies(ImmutableArray`1 versions, KeyValuePair`2[] dependency_handle, Int32 index, Dictionary`2 dependencies, NamedLabel lblDone, NamedLabel lblFail)
   at Pchp.CodeAnalysis.CodeGen.CodeGenerator.EmitVersionedTypeDeclaration(ImmutableArray`1 versions)
   at Pchp.CodeAnalysis.CodeGen.CodeGenerator.EmitDeclareType(SourceTypeSymbol t, Boolean parsePhase)
   at Pchp.CodeAnalysis.Semantics.BoundTypeDeclStatement.Emit(CodeGenerator cg)
   at Pchp.CodeAnalysis.Semantics.BoundStatement.Pchp.CodeAnalysis.CodeGen.IGenerator.Generate(CodeGenerator cg)
   at Pchp.CodeAnalysis.CodeGen.CodeGenerator.Generate(IGenerator element)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Pchp.CodeAnalysis.Semantics.Graph.BoundBlock.Emit(CodeGenerator cg)
   at Pchp.CodeAnalysis.Semantics.Graph.StartBlock.Emit(CodeGenerator cg)
   at Pchp.CodeAnalysis.Semantics.Graph.BoundBlock.Pchp.CodeAnalysis.CodeGen.IGenerator.Generate(CodeGenerator cg)
   at Pchp.CodeAnalysis.CodeGen.CodeGenerator.GenerateBlock(BoundBlock block)
   at Pchp.CodeAnalysis.CodeGen.CodeGenerator.LocalScope.ContinueWith(BoundBlock block)
   at Pchp.CodeAnalysis.CodeGen.CodeGenerator.GenerateScope(BoundBlock block, ScopeType type, Int32 to)
   at Pchp.CodeAnalysis.Symbols.SourceRoutineSymbol.Generate(CodeGenerator cg)
   at Pchp.CodeAnalysis.CodeGen.MethodGenerator.<>c__DisplayClass1_0.<GenerateMethodBody>b__0(ILBuilder builder)
   at Pchp.CodeAnalysis.CodeGen.MethodGenerator.GenerateMethodBody(PEModuleBuilder moduleBuilder, MethodSymbol routine, Action`1 builder, VariableSlotAllocator variableSlotAllocatorOpt, DiagnosticBag diagnostics, Boolean emittingPdb)
   at Pchp.CodeAnalysis.CodeGen.MethodGenerator.GenerateMethodBody(PEModuleBuilder moduleBuilder, SourceRoutineSymbol routine, Int32 methodOrdinal, VariableSlotAllocator variableSlotAllocatorOpt, DiagnosticBag diagnostics, Boolean emittingPdb)
   at Pchp.CodeAnalysis.SourceCompiler.EmitMethodBody(SourceRoutineSymbol routine)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass42_0`2.<PartitionerForEachWorker>b__1()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)  LaravelOnPeachPie   C:\Users\denni\.nuget\packages\peachpie.net.sdk\1.0.23\build\Peachpie.NET.Core.Sdk.targets  245 
jakubmisek commented 1 year ago

thanks for reporting the issue!

Isn't there anything missing in the repo at dennismarksbury/LaravelOnPeachPie ? I have a lot of other compile-time errors when trying to build it.

dennismarksbury commented 1 year ago

Ok sorry about that... there were some files that didn't get added to the repo because the were in folders called "bin", which was naturally excluded in the .gitignore.

I did a fresh pull from the repo to ensure there is nothing else missing.

On Tue, Aug 23, 2022 at 11:34 AM Jakub Míšek @.***> wrote:

thanks for reporting the issue!

Isn't there anything missing in the repo at dennismarksbury/LaravelOnPeachPie https://github.com/dennismarksbury/LaravelOnPeachPie ? I have a lot of other compile-time errors when trying to build it.

— Reply to this email directly, view it on GitHub https://github.com/peachpiecompiler/peachpie/issues/1063#issuecomment-1224242235, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOLO2GB6HRM6GOCMI35KNLV2TVP7ANCNFSM57LHLZXQ . You are receiving this because you authored the thread.Message ID: @.***>

jakubmisek commented 1 year ago

thanks @dennismarksbury - there was a bug in the compiler;

now there seems to be a few errors related to the PHP code itself. Also we've found another minor issue in the compiler - working on it