line-based merge one issue with line-based merging is that it cannot handle two parallel modifications to the same linethe two modifications cannot be combinedonly one of the two modifications must be selected bigger issue is that line-based merge may succeedbut the resulting program is broken because of syntactic or semantic conflicts in the scenario in figure on the facing page the changes made by the two developers are made to independent linesso the line-based merge shows no conflicts howeverthe program will not compile because function is called incorrectly in spite of thisline-based merging is widely used because of its efficiencyscalability,and accuracy three-wayline-based merge tool in practice will merge of the changed files without any issues the challenge is to automate the remaining of the situations that cannot be merged automatically text-based merging fails because it does not consider any syntactic or semantic information syntactic merging takes the syntax of the programming language into account text-based merge often yields unimportant conflicts such as code comment that has been changed by different developers or conflicts caused by code reformatting syntactic merge can ignore all theseit displays merge conflict when the merged result is not syntactically correct we illustrate syntactic merging with small exampleif ( % = then / two developers change this code in different waysbut with the same overall effect the first updates it to if ( % = then / else ( - / and the second developer' update is / both changes to the same thing howevera textual-merge will likely result in : div else :( - / which is syntactically incorrect syntactic merge identifies the conflictit is the integrator' responsibility to manually resolve ite by removing the else portion syntactic merge tools are unable to detect some frequently occurring conflicts for examplein the merge of versions and in figure on the next page will not compilesince the call to sum( has the wrong signature syntactic merge will not detect this conflict since the program is still syntactically correct the conflict is semantic conflictspecificallya static semantic conflictsince it is detectable at compile-time (the compile will return something like "function argument mismatch errortechnicallysyntactic merge algorithms operate on the parse trees of the programs to be merged more powerful static semantic merge algorithms have been proposed that operate on graph representation of the programswherein definitions and usage are linkedmaking it easier to identify mismatched usage static semantic merging also has shortcomings for examplesuppose point is class representing -points using cartesian coordinatesand that this class has distance function that returns suppose alice checks out the projectand subclasses point to create class that supports polar coordinatesand uses points' distance function to return the radius concurrentlybob checks out the project and changes point' distance function to return | |ystatic semantic